can you please tell , how to download attachments from gmail account using php ? thanks
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Can php detect if javascript is on or not?
- Using similar_text and strpos together
IMAP Solution
You must add to it attachment control and you can read this because from it is this source code http://davidwalsh.name/gmail-php-imap
As stated by other answerers, an IMAP solution is recommended, and can be found at http://davidwalsh.name/gmail-php-imap. Make sure to check your firewall, and enable the OpenSSL and IMAP in your PHP installation.
http://www.electrictoolbox.com/extract-attachments-email-php-imap/ has excellent code references regarding how to analyze each email's structure using
imap_fetchstructure
. In the structure of each message lie the attachments. The user contributed notes at http://www.php.net/manual/en/function.imap-fetchstructure.php are particularly helpful (as is the documentation).Basically, you have to
Different email clients will have slightly different structures, but it's not too hard with a little effort. The data can then be handled however you choose.
you could use a php pop or imap client and fetch the mail and extract the attachments from that