Welcome to WebmasterWorld Guest from 54.226.246.160

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

PHP activated by a mail?

Is it possible?

     

gutabo

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

10+ Year Member



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

Thanks in advance!

coopster

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

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



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.

bcolflesh

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

WebmasterWorld Senior Member 10+ Year Member



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

procmail.org/

rhols66.adsl.netsonic.fi/era/procmail/mini-faq.html

wruk999

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

10+ Year Member



gutabo,

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.

Cheers,
wruk999

daisho

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

10+ Year Member



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.

daisho.

anchordesk

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

10+ Year Member



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.

Timotheos

7:06 am on Sep 19, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



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.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month