Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

How to extract mail attachment with PHP?

I'm extracting emails from a database where they're stored as strings. I need to parse these emails to extract their attachments. I guess there must already be some library to do this easily but I can't find any.

user-image
Question ajoutée par Zaid Rabab'a , Software Development Team Leader , Al-Safa Co. Ltd.
Date de publication: 2013/02/12
Faizan Ahmad
par Faizan Ahmad , Software Engineer , cardekho.com

Download the email class http://www.electrictoolbox.com/php-email-message-class-extracting-attachments/

Panneer selvam xavier
par Panneer selvam xavier , Supply Chain Analyst / Trainer , Infonet

i hope this will help you http://stuporglue.org/recieve-e-mail-and-save-attachments-with-a-php-script/

Feras Abualrub
par Feras Abualrub , Web Solutions Manager , Qistas for Information Technology

I've done it once with CodeIgniter MVC , they have useful library for emails (thats why i prefer MVC Frameworks ), you can check this like to get idea about it :http://garrettstjohn.com/entry/extracting-attachments-from-emails-with-php/   However, check this page i believe its very useful also for pure PHP code structure: http://www.electrictoolbox.com/extract-attachments-email-php-imap/

Rani Alomari
par Rani Alomari , Full Stack .Net Developer , Jordan Center for Diseases Control (JCDC)

i usualy use MIME library

islam khalil
par islam khalil , Technical Manager , iCloudit

Use this Library: https://github.com/barbushin/php-imap/blob/master/example/index.php Example Code: require_once('../ImapMailbox.php'); // IMAP must be enabled in Google Mail Settings define('GMAIL_EMAIL', 'some@gmail.com'); define('GMAIL_PASSWORD', '*********'); define('ATTACHMENTS_DIR', dirname(__FILE__) .
'/attachments'); $mailbox = new ImapMailbox('{imap.gmail.com:993/imap/ssl}INBOX', GMAIL_EMAIL, GMAIL_PASSWORD, ATTACHMENTS_DIR, 'utf-8'); $mails = array(); // Get some mail $mailsIds = $mailbox->searchMailBox('ALL'); if(!$mailsIds) { die('Mailbox is empty'); } $mailId = reset($mailsIds); $mail = $mailbox->getMail($mailId); var_dump($mail->getAttachments());

More Questions Like This