ankur0101 Posted December 1, 2010 Share Posted December 1, 2010 Hi everybody, I want to create a script which will send SMS on a number once new mail arrives in email account. I have SMS API service from http://www.freesmsapi.com/ I am using cPanel, but how to do it ? One idea is, new mails are stored in "new" folder and already read mails are stores in "cur". So once, new email file will come in "new" folder PHP script will see that file and will send SMS, with text as "Hi, {user}, you gotta mail from {sender}, subject is {sibject}" That PHP file will be added to Cronjobs. But how to do it ? I have been searching on this issue from many months, did google but no answer. I need help Quote Link to comment Share on other sites More sharing options...
dawsba Posted December 1, 2010 Share Posted December 1, 2010 picked this up from http://bytes.com/topic/php/answers/3651-email-trigger-php-function Do this: (i know guys, there are other ways to do it with procmailrc, but most people mess that file up) in /etc/mail/virtusertable: someemail@somedomain.com aliasScriptName then in /etc/alaises aliasScriptName "| /etc/smrsh/scriptname" then in /etc/smrsh/scriptname #!/usr/bin/php -q <?php // read from stdin $fd = fopen("php://stdin", "r"); while (!feof($fd)) { $inData = fgets($fd, 1024); $inData = trim($inData); .. proccess $inData here ... } fclose($fd); ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.