Steven Talcott Smith
2006-Oct-09  02:12 UTC
ActionMailer Multipart messages broken for Quoted-printable
I still do not have a blog up so I will post here.  May Google record 
this so that others can find my answer and save themselves a couple 
hours of debugging....
If you use the default encoding for multipart mime mail, ActionMailer or 
TMail or something messes up your HTML tags and inserts a "3D" string 
between every attribute="" so that you get tags looking like this:
<style type=3D"text/css">
You may never notice because your email program will render it anyway 
but it has deleterious effects on your delivery and spam ranking as this 
is not valid HTML.
I traced the code a bit hoping to make a fix but eventually, in the 
course of testing, found a workaround.
The workaround is to explicitly specify multipart messages per the 
instructions in the API for ActionMailer::Base and then Base64 encode 
the HTML portion of your email.   (Implicit multipart and 
Quoted-printable for html multipart are broken)
ie.
    content_type "multipart/alternative"
    part "text/plain" do |p|
      p.body =
render_message(''marketing_email.text.plain.rhtml'', @body)
    end
    part "text/html" do |p|
      p.body =
render_message(''my_important_email.text.html.rhtml'',
@body)
      p.transfer_encoding = "base64"   # VERY IMPORTANT
    end
Hope this helps somebody.
Best,
Steven
-- 
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2006-Oct-09  08:35 UTC
Re: ActionMailer Multipart messages broken for Quoted-printa
Steven Talcott Smith wrote:> I still do not have a blog up so I will post here. May Google record > this so that others can find my answer and save themselves a couple > hours of debugging.... > > If you use the default encoding for multipart mime mail, ActionMailer or > TMail or something messes up your HTML tags and inserts a "3D" string > between every attribute="" so that you get tags looking like this: > > <style type=3D"text/css"> >Is this really wrong? The = character is illegal in quoted printable, and so must be represented as =3D Fred -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---