Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Would using Content-Transfer-Encoding: base64 for text and html email present any issues?

Tags:

email

base64

smtp

I'm working on an email project. For reasons that I will not go into here, doing quoted-printable encoding on long email messages is problematic in the customer's environment.

Doing base64-encoding on the HTML and text sections of the SMTP emails we are sending seems like a viable option. In testing it, it seems to work just fine in a couple test clients (like Gmail).

However I'm wondering if this will present any issues across different email clients. From reading the RFC specs, it looks like base64 is a compliant encoding for text sections, but it's unusual enough for text & html sections that I'd like to know if there will be any potential issues to consider.

Things that seem like problematic possibilities:

  • perhaps some older or less robust clients don't expect base64 in text or HTML email sections, and will fail to encode it
  • perhaps some email clients do a preview or search based on the raw content, so recipients would see base64 instead of the actual content
  • perhaps base64 could negatively influence deliverability/spam scoring?

Does anybody have experiences they can share? This seems like a good solution but I'd like to make sure I'm not missing something.

like image 601
jkraybill Avatar asked Apr 25 '13 05:04

jkraybill


1 Answers

This is hard to answer -- yes, quoted-printable is used more often simply because it wastes less bytes (on a mostly-ASCII text) and because the raw text of the mail body part resembles the decoded output (on a mostly-ASCII text). There is nothing which forbids using base64 for the textual message parts, though.

This is pretty much an open question -- you cannot ever be sure that a MUA somewhere is not hopelessly broken to the extent of not showing anything. There's a lot of "perhaps" in there, and you're right -- but the problem is that you will never know. If it will make you sleep better, the following companies all use base64-encoded HTML in the marketing spam I'm receiving:

  • Mellanox
  • Alza.cz
  • Aukro.cz
  • Journal of Modern Physics

Any MUA which can display embedded images has to include a base64 decoder. It is definitely possible that a MUA might explicitly refuse to use that code for decoding text/plain and text/html, but in that case, you're just screwed anyway.

As a fun fact, one of these companies is happy to break the UTF-8 encoded subject at the byte boundary, inside a multibyte character, and encode both halves of the text in separate encoded-words (RFC2047 terminology here).

like image 167
Jan Kundrát Avatar answered Sep 28 '22 04:09

Jan Kundrát