Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

PHP activated by a mail?

Is it possible?

5:08 pm on Sep 18, 2003 (gmt 0)

Junior Member

10+ Year Member

joined:Sept 17, 2001
votes: 0

Is it possible to send a mail to "bar@foo.com" with some parameters (could be like
you=not me
or just
not me)
and make a PHP script(or something else) receive the message, and parse it?

Thanks in advance!

5:46 pm on Sept 18, 2003 (gmt 0)


WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 31, 2003
votes: 2

If you want to send mail use the mail() function. You can find more information regarding how to use PHP mail in the PHP Manual [us4.php.net].

As far as receiving the mail and parsing...well, that's out of your control. The recipient's server determines how to handle the mail, not you.

5:54 pm on Sept 18, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 21, 2003
votes: 0

Many mail processing progs have options to process mail with external scripts - does your server have procmail?:



5:59 pm on Sept 18, 2003 (gmt 0)

Full Member

10+ Year Member

joined:Nov 17, 2002
votes: 0


You could, if you have access to the server that you host on, edit the aliases file (on unix) and point a email address to a perl file, use the perl file to read any values and arguments, and then use that to pass to PHP.

I thin this is a very basic outline of how it can be done, but I think that it is a possibility.


7:15 pm on Sept 18, 2003 (gmt 0)

Preferred Member

10+ Year Member

joined:Jan 31, 2003
votes: 0

procmail is definatly the way to go if you have it. It's a very powerfull tool. I do just that looking for bounce messages. A mail comes in an a PHP script fires to process it. Then decide weither to pass it to me or delete it.


2:44 am on Sept 19, 2003 (gmt 0)

Junior Member

10+ Year Member

joined:Aug 8, 2003
votes: 0

Sure ... anything a human on a browser can do can be replicated with some kind of scripting. Addressing the "or something else" rather than the PHP part of your question, the perl module Mail::POP3Client makes it a snap to write a perl script to check a pop3 account and automatically manipulate email to your hearts content. Set the script up to run automatically every few minutes/hours and it's makes for a nice way to handle various concerns of incoming email.
7:06 am on Sept 19, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 13, 2003
votes: 0

I would think it's do able. Here's an interesting article [devshed.com] that would get you started on retrieving the email with PHP. To do it automatically you'll need to set up a cron job.

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members