Skip to content Skip to sidebar Skip to footer

How To Determine If A Mail Fetch By Imap Base64 Encoded?

I saved the whole message as xx.eml, but some mails body tells that mail is encoding by base64 at the first line, for example: charset='utf-8' Content-Transfer-Encoding: base64

Solution 1:

Emails that are transfered as BASE64 must set Content-Transfer-Encoding. However you are most likely dealing with a MIME/Multipart message (e.g. both text/plain and HTML in the same message), in which case the transfer encoding is set separately for each part. You can test with is_multipart() or if Content-Type is multipart/alternative. If that is the case you use walk to iterate over the different parts.

EDIT: It is quite normal to send text/plain using quoted-printable and HTML using BASE64.

Content-Type: multipart/alternative; boundary="=_d6644db1a848db3cb25f2a8973539487"Subject: multipart sampleFrom: Foo Bar <foo@example.net>To: Fred Flintstone <fred@example.net>

--=_d6644db1a848db3cb25f2a8973539487
Content-Transfer-Encoding: base64Content-Type: text/plain; charset=utf-8

SOME BASE64 HERE
--=_d6644db1a848db3cb25f2a8973539487
Content-Transfer-Encoding: base64Content-Type: text/html; charset=utf-8

AND SOME OTHER BASE64 HERE

Post a Comment for "How To Determine If A Mail Fetch By Imap Base64 Encoded?"