Email to sms

this is a commonly asked question before all programmers how to send
an sms upon receival of an email in a mail server

The method i am narrating here expects some requiremnts as below

1. sms gateway
2. cPanel driven server
3. email pipe support
4. php support

Let us start with cPanel

Login to your cPanel like

Once logged in go to section Mail

Create a mail box from

Mail>email accounts>create account

Now go to


Click on button Add Forwader

Enter email address

Now go to the bottom advanced options link

Expand the link

Select pipe to a program

Here you will be asked to enter full path of the script relative to
the home directory

Be careful whilw entering

For eg. If the file is under public_html
Enter it as public_html/script.php

Insted of /public_html/script.php

The file should have permission 754

And hashbang on top,
For php it is as below

!#/usr/bin/php -q

Here -q is to avoid printing php version to screen on execution

Under this hashbang we can campaign any php to do anything

This piping forwards all emails to the php with message with all
headers as standard input

And we may read this using php stdin which is narrated in detail next
post on plz go through

And if there is a sms gateway with you straightaway you may send sms
from this forward

Published by


a gadget and internet addict , a red hat certified linux administrator with skills in dataware development and online technologies., follow me on twitter @abhilashsnair

2 thoughts on “Email to sms”

  1. Pingback: abhilash
  2. Pingback: abhilash

Comments are closed.