PHP Classes

Apparent change in encoding type means attachments are not found

Recommend this page to a friend!

      PHP MIME Email Message Parser  >  All threads  >  Apparent change in encoding type...  >  (Un) Subscribe thread alerts  
Subject:Apparent change in encoding type...
Summary:automatically forwarded attachments from gmail not recognised
Messages:4
Author:phil
Date:2011-08-18 11:51:07
Update:2011-09-19 09:46:51
 

  1. Apparent change in encoding type...   Reply   Report abuse  
Picture of phil phil - 2011-08-18 11:51:07
Hi Manuel

Great code - many thanks. I had this working really well to strip off attachments that were automatically forwarded to a php script. This worked until we changed mail server (moved to gmail) and the automatic forwarder stopped working. However when I manually forward the same message with the same attachment in gmail it works!

I have pasted the emails code into two files, one of which works & the attachment is stripped off (when I manually forward it) and one which does not work and the attachment is not found (automatically forwarded by gmail).

societe.org.gg/temp/works.doc
societe.org.gg/temp/does_not_work.d ...

The only real difference I can see is the Content-Transfer-Encoding which is different (base64 works, 7bit does not).

Does this make sense? Any help you can give would be much appreciated

Many thanks

Phil

  2. Re: Apparent change in encoding type...   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2011-08-24 06:27:41 - In reply to message 1 from phil
This is vague. What do you mean by it works or it does not work?

I looked at the messages and despite both contain the same attached file, in one the file is a simple attachment of a text message, and another the file is attached to a more complex HTML message with an alternative text part, but the file is the same.

Could you be setting the mbox flag? If so, you shouldn't because this is only one message that contains another in the body. The mbox flag is just for multi-message archives in the mbox format.

  3. Re: Apparent change in encoding type...   Reply   Report abuse  
Picture of phil phil - 2011-09-13 15:10:55 - In reply to message 2 from Manuel Lemos
Dear Manuel

Thanks for your reply - what I was trying to say was that I installed the script and sent some emails to it. What I wanted was the attachments processed and saved locally to my server.

When the email with the attachment 'works.doc' is processed by the script, it is successful and the file is saved locally.

When the email 'does not work.doc' is sent by my gmail forwarder to the SAME script and with the same attachment, it is unsuccessful and provides an error. Has gmail malformed the mail somehow

As you say both emails contain the same attachment, but one is successfully processed and one is not.

I checked the mbox flag and it is not set

If you have any other suggestions, I would be pleased to hear them.

Many thanks

Phil


  4. Re: Apparent change in encoding type...   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2011-09-19 09:46:51 - In reply to message 3 from phil
There are several problems.

The first is that both messages have a line with spaces at the top which prevents the parser to figure where the message starts correctly. Assumming that you inserted that line of spaces, I stripped it to see what are the differences.

Parsing the messages here without the mbox flag set, returns a body part that starts with a line that says "Here is the the full email:". These top lines need to be stripped until the first real header line, so you can parse the rest of the message which is the full forwarded message.

Now parsing those messages, the one you say it works is an HTML message with an alternative text part and the attached file.

The one you say it does not work is the actual file sent text body message, so it is not attached to a message with several parts.