[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Sending Mail (text message) from 'Phone Number' in PHP

Posted on 2009-04-28
1
Medium Priority
?
371 Views
Last Modified: 2012-06-27
I have setup an ecommerce site for a customer and we set it up to notify them via text-messages to their phone every time a new order is placed or something on the site needs attention.  It works great, however, the from "number" in the text message is always some random 10 digit number.

I'm wondering if there is a way to make this look like it is coming from a specific phone number.
function textMessage($txtnum,$orderNum){
	$eol="\r\n";
	$from_name	=	'mydomain.com';
	$from_email	=	'8882019987';  // From Phone Number
	$sendto = $txtnum;
	$orderno = $orderNum;
	$headers .= "MIME-Version: 1.0\r\n";
	$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
	$headers .= "From: ".$from_email."\r\n";
	$headers .= "Reply-To: ".$from_name." <".$from_email.">\r\n";
	$headers .= "X-Mailer: PHP v".phpversion().$eol; 
	$subj = "New Order: $orderNum"; 
	$body = "New Order on the Online Store";		
	
	mail($sendto, $subj, $body, $headers);
}

Open in new window

0
Comment
Question by:beigs
1 Comment
 
LVL 4

Accepted Solution

by:
joep1978 earned 2000 total points
ID: 24251637
Generally the SMS provider has a limited set of numbers that the message can be sent from - you would need to talk to them about the best solution for you.  I very much doubt you'll be able to specify the exact phone number, but they may be able to set you up so the messages are sent from a more friendly number.
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
The title says it all. Writing any type of PHP Application or API code that provides high throughput, while under a heavy load, seems to be an arcane art form (Black Magic). This article aims to provide some general guidelines for producing this typ…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses
Course of the Month18 days, 10 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question