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 mbsendmail() with the following headers:

"From: \"\" <>\r\nReply-To: \"Webmaster\" <>\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

- base64 content

6 Replies

Well, that's base64-encoded.



import base64


'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.

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


edit by jed: done, sorry.


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 ;)

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?


mbsendmail() 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 mbsendmail sent as quoted-printable); or just use plain old mail().

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!



Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct