Sunday, October 17, 2010

Ubuntu server send SMS text messages to cell phone

Not sure if anyone else has wondered this, but I had a ubuntu email server and I wanted to set it up to send SMS message automatically so users on cell phones could get updates. Well, that is easy, just poin the email to:
10-digit wireless number@mms.att.net

For example
If my area code was 775 and my phone number was 111-3333 I would do:

7751113333@mms.att.net

So if I was using PHP my code would be:

$phoneNumber=7751113333
$to = $phoneNumber."@mms.att.net"; //combine phone number to send message
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
if (mail($to, $subject, $body)) {
echo("

Message successfully sent!

");
} else {
echo("

Message delivery failed...

");
}

No comments: