Re: Handling Incoming Email Attachments

From: Date: Tue, 06 May 2008 09:43:06 +0000
Subject: Re: Handling Incoming Email Attachments
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-273937@lists.php.net to get a copy of this message
Nirmal Jayasinghe wrote:
hello all, I'm trying to figure out a way to manipulate incoming email attachments with PHP. There'll be a special email address to which the emails with the attachments would be sent, with a number specified in the subject line. What I need to do is to grab the attachment (a photo), rename it with the number specified in the subject line, and move it onto a specific folder on the Web server [which will be running LAMP]. I couldn't find any online material describing how to manipulate incoming mail attachments. Can someone give an idea? Hi,
For handling e-mail in all their sorts (believe me, it is hell), I found the PECL mailparse the best solution. It can find the attachments and their MIME-types in a snap. And all the headers are separated too. You only have to wrap functions around it to do what you want to do. Be sure to validate the attachments and do not rely on the MIME-type only. People can spoof that kind of files. -- Aschwin Wesselius /'What you would like to be done to you, do that to the other....'/

« previous php.general (#273937) next »