PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > php.general > Handling Incoming Email Attachments
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Handling Incoming Email Attachments

Réponse
 
LinkBack Outils de la discussion
Vieux 06/05/2008, 10h36   #1
Nirmal Jayasinghe
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Handling Incoming Email Attachments

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?


Thanks,

Chuck Finster

  Réponse avec citation
Vieux 06/05/2008, 10h43   #2
Aschwin Wesselius
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] Handling Incoming Email Attachments

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....'/

  Réponse avec citation
Vieux 06/05/2008, 10h52   #3
Richard Heyes
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] Handling Incoming Email Attachments

> 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.


There's also the PEAR mimeDecode class as well. A PHP solution so it
won't require you to reconfigure/compile anything.


--
Richard Heyes

+----------------------------------------+
| Access SSH with a Windows mapped drive |
| http://www.phpguru.org/sftpdrive |
+----------------------------------------+
  Réponse avec citation
Vieux 07/05/2008, 07h49   #4
Manuel Lemos
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Handling Incoming Email Attachments

Hello,

on 05/06/2008 06:36 AM Nirmal Jayasinghe said the following:
> 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?


You may want to try this MIME parser class. It can parse the e-mail
messages of any size and optionally save the attachments to files in a
directory of your choice.

http://www.phpclasses.org/mimeparser

If want to parse messages retrieved from a POP3 mailbox, you may also
want to use in conjunction this POP3 class which comes with a stream
wrapper that lets you access messages in the POP3 mailbox as if they
were files. You can use file names like this: pop3://pop.server.com/1 .

http://www.phpclasses.org/pop3class

When used in conjunction, these two classes allow you to extract
attachements from messages of any size without exceeding your PHP memory
limits.

--

Regards,
Manuel Lemos

PHP professionals looking for PHP jobs
http://www.phpclasses.org/professionals/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 17h27.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,11247 seconds with 12 queries