Linode Forum
https://forum.linode.com/

Email garbled...
https://forum.linode.com/viewtopic.php?f=11&t=5296
Page 1 of 1

Author:  pmmenneg [ Fri Mar 12, 2010 5:16 pm ]
Post subject:  Email garbled...

Hi all. So I am sending mail from a PHP application, and I have an issue where the email comes out garbled if the recepient is using a forwarding service, such as GoDaddy, etc.

I am going to follow-up with them to see if it is an issue on their end, but before getting the run-around, I'd like to see if this is an issue that someone else may have encountered.

I am using mb_send_mail() with the following headers:

"From: \"webmaster@example.com\" <webmaster@example.com>\r\nReply-To: \"Webmaster\" <webmaster@example.com>\r\nMIME-Version: 1.0\r\nContent-Type: text/plain; charset=UTF-8"

Instead of getting this message:

"Test email"

this is what is received

<snip> - base64 content

Author:  jed [ Fri Mar 12, 2010 5:37 pm ]
Post subject: 

Well, that's base64-encoded.

Python, king of all programming languages on Earth wrote:
>>> a="RlJPTTogUGF1bCBNZ......="
>>> import base64
>>> base64.b64decode(a)
'FROM: xxxx\r\n\r\nEMAIL: xxxx\r\n\r\nMESSAGE:\r\n\r\nTesting this feature'


PHP appears to be base64-encoding the e-mail and whatever is receiving isn't reading it correctly (or PHP isn't sending it correctly). Couldn't tell you how to fix it, but now you know what to Google.

Author:  pmmenneg [ Fri Mar 12, 2010 5:40 pm ]
Post subject:  Ah thanks...

Can you remove the decoded content from your post? Prefer not to have name and email in the wild for spammers.

Paul

edit by jed: done, sorry.

Author:  Stever [ Sat Mar 13, 2010 1:15 am ]
Post subject: 

jed wrote:
Python, king of all programming languages on Earth

Nah, assembly is the king - all others are merely wrappers for mortal programmers who would go blind if they were to see the true code with their naked eyes ;)

Author:  pmmenneg [ Sat Mar 13, 2010 3:32 pm ]
Post subject: 

Thanks for the insight guys. Anyone else have any ideas why emails that get forwarded via a service like GoDaddy would be arriving in base64 encoded format?

Thanks!

Author:  mjrich [ Mon Mar 15, 2010 3:31 pm ]
Post subject: 

mb_send_mail() calls mb_language; thus as a wild stab in the dark I'd say that you're defaulting to uni (and hence UTF-8/Base64 encoding).

You could either explicitly set the language to English (and have your emails from mb_send_mail sent as quoted-printable); or just use plain old mail().

Author:  pmmenneg [ Mon Mar 15, 2010 4:27 pm ]
Post subject:  That did it!

Adding in the mb_language('en') call did the trick. We are using multi-byte for future friendly expansion, if and when we move to supporting more languages, etc.

Thanks for the pointer!

Paul

Page 1 of 1 All times are UTC-04:00
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/