MLUG: RE: [MLUG] How do I get a PHP script to listen for incoming email
RE: [MLUG] How do I get a PHP script to listen for incoming email
Email address obfuscation in effect -- please click here to turn it off.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
> 
> The best idea I can come up with so far is to set up a cron job that 
> periodically logs into a POP account and downloads the mail.  
> Is there any 
> way I can trigger execution of the script when mail arrives 
> in the box 
> rather than constantly poll for mail?
> 

You'll need access to the /etc/aliases file - alternatively you'll need
to be able to use procmail or sieve or similar mail processing
facilities offered by your host.

There you can pipe email to another program for processing - that
program could be your php script as a php shell script.

You'd have something like this in /etc/aliases

run-script:	"|/usr/local/sbin/myscript.php"

Then any email to EMAIL:PROTECTED will be passed to your myscript.php
file - assuming it's executable and yu start the script with something
like:

#!/usr/bin/php

Russell.

_______________________________________________
members mailing list
EMAIL:PROTECTED
http://mlug.missouri.edu/mailman/listinfo/members