Re: adding text and jpegs from mail to mysql database.

From: Date: Mon, 12 May 2003 09:27:05 +0000
Subject: Re: adding text and jpegs from mail to mysql database.
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-147276@lists.php.net to get a copy of this message
Anders Thoresson wrote:
Hi, I want mail sent to blog@thoresson.net to get added into my mysql database. I want to use the subject, the text in the body and any attached jpegs. Mails sent to blog@thoresson.net ends up in a pop3-mailbox together with mail sent to many other addresses as well, so I've to check the TO-field as well.
*IF* you control thoresson.net box, and have access to the sendmail configuration and alias set up, or even if your ISP will do it for you... You may, or may not, find it easier to use "smrsh" and edit "/etc/aliases" to force email coming into that particular address to be sent to a script. That script could be written in any language you like, including PHP. man smrsh is probably your best starting point. Trying to comprehend all of sendmail.cf is probably (A) not needed and (B) a Bad Idea unless you own an aspirin factory. :-) You basically just need to find the right line and put in something like: blog: "|yourprocessingscript.php blog" in /etc/aliases This tells sendmail that any incoming email for "blog" should be "piped" (the | part) to the PHP script in /etc/smrsh named "yourprocessingscript.php" and, err, I think the extra "blog" I have in my case is how I use the same script to handle different mailing list processing things... It's been ages since I've looked at this stuff. But once I found "man smrsh" and some examples, it really wasn't that tricky.

« previous php.general (#147276) next »