PHP Question

software development


It is possible to be able to receive email alerts (say, from Google News) and publish them to a web page automatically?

I am a novice as far as PHP goes, but I can open and write to a file and close the file up again. The html page references the file and can format the plain text. So far I am OK ( I think ).

I am not sure how I would automate, or get the content of the email, and output it to a file. Any thougths?


What you’d probably do is use procmail to send incoming email to a script.

In .procmailrc, you’d have:
:0 c
| php $HOME/myscript.php

In myscript.php, you’d use fopen(‘php://stdin’, ‘r’) to read the standard input (which is the email)

I haven’t tried it in exactly this way, but hopefully that gives you an idea how to send an email to a program…


PHP isn’t installed on the mail servers. You’d have to use python or Perl.


You could also run a script every once in a while (via a cron job) that checks an email account for messages and posts them. The email-to-blog function of WordPress works that way, for example.


Thanks for the responses. If Procmail isn’t an option then I’ll investigate the second option.

Now I’m reading up on cron jobs.