PHP Classes

attachments processing

Recommend this page to a friend!

      POP3 e-mail client  >  POP3 e-mail client package blog  >  How Can PHP Read Emai...  >  All threads  >  attachments processing  >  (Un) Subscribe thread alerts  
Subject:attachments processing
Summary:how to deal with attachments...
Messages:11
Author:Omar Garro
Date:2010-04-14 16:41:28
Update:2013-08-21 09:03:53
 
  1 - 10   11 - 11  

  1. attachments processing   Reply   Report abuse  
Picture of Omar Garro Omar Garro - 2010-04-14 16:41:28
Is that possible ?
I need that Sales Department users send every kind of documentation they have about quotations attached in an email.
I need to save the body of each email in a DB and have its attachments downloaded to a particular location.

  2. Re: attachments processing   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2010-04-14 23:18:18 - In reply to message 1 from Omar Garro
You can use the MIME parser class to parse the messages and extract the attachments.

Take a look at the browse_mailbox.php example script.

  3. Re: attachments processing   Reply   Report abuse  
Picture of Leo Leo - 2013-08-14 14:00:31 - In reply to message 2 from Manuel Lemos
Hello Manuel,

First thank you very much for this class.
I tried it in combination with your mime parser class and it decodes the email message very well.
The first class / code I found that can decode 'multipart/mixed' emails.

But the attachments, and inline images, that are saved to the server are not decoded correctly, I think.
The images are not fully saved or malformed.
What can I do to make the decoding of the attachments correctly ?
Do I have to select the encoding type of the attachments somewhere?

Thanks for your time !

  4. Re: attachments processing   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2013-08-14 14:29:32 - In reply to message 3 from Leo
What do you mean saved to the server? Is it saving to files?

The class decodes and saves the message parts automatically, you do not need to specify any encoding type.

Now, if you want to show message parts like HTML or text, you need to pay attention to the original message part encoding type.

  5. Re: attachments processing   Reply   Report abuse  
Picture of Leo Leo - 2013-08-14 14:48:44 - In reply to message 4 from Manuel Lemos
Wooah what a fast reply !

I'm using the brows_mailbox.php file as base,
and changed the $parameters array so it contains a filepath in 'SaveBody' and 'SkipBody' is '0'.

All attachments, images and pdf files, the plain bodymessage and html bodymessage are all saved to the 'SaveBody' directory.
But the images are not decoded properly, it's impossible to see what should be displayed in the images.
The html and plain bodymessage are decoded very well, even the correct character encoding.

If encoding should be done automatically, is something wrong with the connection to the server?
Or are not all different types of encoding supported?
What can I do to pinpoint 'the problem' ?

Thanks in advance!

  6. Re: attachments processing   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2013-08-15 03:03:46 - In reply to message 5 from Leo
Can you download the a sample message and upload it somewhere so I can see if the problem is in the message?

  7. Re: attachments processing   Reply   Report abuse  
Picture of Leo Leo - 2013-08-21 07:23:32 - In reply to message 6 from Manuel Lemos
Hey Manuel,

I've made an example mail with embedded images and attachments, images and attachments consists of sample images from Windows.
Here is the download link to "test email subject" email (via WeTransfer):
we.tl/hUo2LIyRX9

Hopefully you can test if you successfully can import the message with your "browse_mailbox" script.
When I import the testmail, some embedded images are 'visible' but corrupt, most can't even be opened.

Thanks in advance !

  8. Re: attachments processing   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2013-08-21 07:35:22 - In reply to message 7 from Leo
What is this archive format? I am not able to extract it.

  9. Re: attachments processing   Reply   Report abuse  
Picture of Leo Leo - 2013-08-21 08:15:47 - In reply to message 8 from Manuel Lemos
What you download at WeTransfer is a *.msg file. It's not 'zipped' or something, if that's what you mean with 'archive format'.
The email is made with "Microsoft Outlook 2010".


  10. Re: attachments processing   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2013-08-21 08:42:15 - In reply to message 9 from Leo
This is useless because the POP3 class only gets from the server MIME messages, which are plain text.

What I need to reproduce your problem is the actual MIME message retrieved from the server, not Microsoft Outlook message format which is proprietary and is not used by the POP3 protocol.

 
  1 - 10   11 - 11