Possible Duplicate:
email checking and then act upon script for reacting to a sms message
Suppose that I have two functions called recieve_email() and send_sms().
The problem is that I should send SMS as soon as a new email arrives.
As I have researched, there are these 2 solutions:
- Checking emails using a cron job
- Checking emails using a web page that is always open using javascript (like gmail)
I think that the more stable way is the cron job.
I want to know is that aceptable to run a cron job EVERY SINGLE MINUTE? Or does it kill the server and bounce my site away?!
What about running the cron job every two minutes?! 😀
Question 2:
Is there an on_mail_recieved like solution? It will be of course faster and optimum.
Generally, that’s fine. If there’s a chance the job will take longer than a minute you should generally implement a lock file or semaphore to prevent it from running multiple instances at the same time.
Yes, you can pipe e-mails through to a script. This requires you to run a mail server and can be a little involved technically.