Re: receive mails through php



C. (http://symcbean.blogspot.com/) wrote:
On 20 Apr, 06:33, gordonb.5o...@xxxxxxxxxxx (Gordon Burditt) wrote:
I want to write one php script which can accept any mail send to my
mail id. Can any one help me out in this.
If you are running a UNIX (or similar, such as Linux) system with
its own mail transport agent like Sendmail or Exim, you can use a
".forward" file in your home directory to specify that the message
should be piped into a command that you specify (which could be a
PHP script). For safety until it is debugged, I recommend directing
the mail to a file *and* the command, so when the first try blows
up, you don't lose mail. You can also set up an alias which receives
mail by piping it into a command.


Most Linux distros come with MTAs configured to use procmail as the
delivery agent. Procmail allows you to do lots different things - its
a programming language all of its own.


Not true. SOME distros use procmail as a default. Debian, for instance, defaults to Exim. Others use sendmail.

e.g. you could set up a recipe which:

1) checks 'from' addresses in incoming mail and automatically rejects
any not in a white list
2) forward all messages with 'PHP' in the subject to a different
mailbox
3) passes the remainder to a virus scanning pipe
4) automatically responds to any messages still in progress
5) send a copy of any message addressed to 'php@xxxxxxxxxxx' to a
script, and a copy to your normal mailbox
6) filter any remaining messages through a different script
7) ....?

If you can't setup .forward or .procmailrc on your system then you'll
have to pool the message via imap or pop.

C.

Any MTA can be set up to forward email, but that isn't what he's looking for.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@xxxxxxxxxxxxx
==================
.



Relevant Pages