views:

32

answers:

2

I'm using Rails to send emails and I just want to send a plain text email (there is no corresponding HTML part).

I've noticed that if I just have one file named email.text.plain.erb it actually generates a multipart email with one part (the plain text part) like this:

Content-Type: multipart/alternative; boundary=mimepart_4c04a2d34c4bb_690a4e56b0362

--mimepart_4c04a2d34c4bb_690a4e56b0362
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: Quoted-printable
Content-Disposition: inline

text of the email here...

--mimepart_4c04a2d34c4bb_690a4e56b0362--

But if I take out the text.plain part and name it email.erb ActionMailer generates a regular plain text email without multipart like this:

Content-Type: text/plain; charset=utf-8

text of the email here...

Both work fine most of the time (so this is kind of nitpicky), but I guess my question is whether the second one is more correct. My goal here is just to make sure deliverability is as high as possible across a wide variety of devices and email clients.

I've read that plain text emails can have slightly better deliverability rates than html and was just curious if throwing in this multipart (even if it only contained a plain text part) might throw off some of the dumber email clients. Thanks for your help!

+1  A: 

It's unlikely to have an affect these days. It used to be that there existed email clients that didn't support multi-part messages at all, but today they all do: even if it's just to strip off the HTML and display only the plain text.

It's good to just send the plain text from the point of view that you're saving a few bytes, but I don't imagine it would hurt otherwise.

Dean Harding
+1  A: 

I'd go for number two. While most email software handle multipart messages just fine these days, you gain nothing by wrapping a plain text email into a separate part.

harald