ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

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
تم إضافة السؤال من قبل Zaid Rabab'a , Technical Team Lead , ESKADENIA Software
تاريخ النشر: 2013/02/12
Faizan Ahmad
من قبل Faizan Ahmad , Software Engineer , cardekho.com

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

Panneer selvam xavier
من قبل 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
من قبل 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
من قبل Rani Alomari , Full Stack .Net Developer , Jordan Center for Diseases Control (JCDC)

i usualy use MIME library

islam khalil
من قبل 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());

المزيد من الأسئلة المماثلة