great, that evolt article looks promising (full article at:
http://www.devarticles.com/c/a/PHP/Incoming-Mail-and-PHP/1/ )
so now I have a few newb questions to annoy you all with..
The article says: "The first thing we have to do, is tell our mail system to send all mail addressed to
script@example.com to our script. How to accomplish this, depends on which mail system you use."
The article gives a few examples, Sendmail, Exim, and Qmail. (I read elsewhere about these, and apparently they are called Mail Transfer Agents, and sit between the Mail User Agent and the Mail Delivery Agent.) For each MTA the forwarding options are basically either creating a .forward file or an alias, if root access is available.
I figured the first thing to do was to try to make a .forward file and try forwarding mail somewhere, so I stuck a file called ?.forward? and containing an e-mail address into the mail directory for an email account on my site, but apparently it was the wrong place, because it didn?t work, and other locations I tried also failed.
I then read about Sendmail aliases, which are apparently kept in the file /etc/aliases, but I cannot find this in my directory anywhere. I am running my site off a shared server, so maybe I don?t have access to the directory -- I have no idea. (I also can?t locate obvious way to determine what MTA my hosting providers (modwest.com, xr4free.com) use.)
Once I set up the forwarding, it appears that I can forward the incoming email to a PHP script for parsing, but I need some advice on properly setting up the .forward and/or alias file.
Second of all, it looks like this is one of two ways to make PHP accept e-mails, the other of which is using crontab to check periodically for email to parse, as RSMemphis and others suggested above. Unless I am mistaken, the latter method seems to have the advantage that parsing is not dependent upon any specific "to:" address that triggers forwarding to the script. This would mean that if I wanted to make each user's e-mail address a command (for example, mail sent to any address such as
username@mysite.com alters the relevant user's account in some way), I could do that without adding this address to a .forward or alias file manually for each user. Perhaps you can tell me if I am understanding this correctly. If I understand this correctly, then perhaps a pipe is not the best way.
Thanks again and sorry if these questions sound kind of stupid ? I have very little experience with this stuff. I will keep searching around so that I can avoid asking questions whose answers are available online somewhere.