Sending messages to mobile phones in PHP

December 2016


We will try to forward a mail as such
  • Number:the phone number assigned to the mobile phone
  • ISP: your Internet service provider. E.g, etc


Here's how it should look like:
  • The message is written with the web application that runs on the HTTP server
  • E-mail is received by the SMSG server (SMS gateway) which converts it into SMS
  • The message is finally transmitted to the recipient on his mobile phone.

PHP: The mail() function

We simply use the mail() function of PHP for this. Here's an example of a code to send an SMS in php:

$to = "";
$message = "Ceci a été envoyé en PHP !"

if( mail($to, ' ', $message) ) {
echo "Message envoyé !";

Note and image source

Note: Please note that the SMS can take several minutes (58 minutes when tested) to reach the recipient.
  • Image source: Net.tutsplus

    Related :

    This document entitled « Sending messages to mobile phones in PHP » from CCM ( is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the license, as this note appears clearly.