Jason FB
2011-May-03 16:20 UTC
problems with ActionMailer & multipart emails, works in OS X Mail but not in other mail readers
I''m on Rails 3.0.7 and having problems with the ActionMailer & multipart emails -- has anyone verified that when sending multipart emails they work correctly in several email readers? Here''s my mailer: def feature_announce(user) @user = user mail(:to => "#{user.name} <#{user.email}>", :subject => "Test Feature Announcement") end I have a template for feature_announce.html.erb and another feature_announce.text.erb This syntax is taken straight from the ActionMailer guide for Rails 3. The email works fine (plain text & html) in Apple Mail, but doesn''t appear correctly on Gmail (web browser interface) or on iPhone. When I open the message in Gmail, I see this (I''ve obscured the sender name) http://screencast.com/t/V6zNUhjsE8A If I click on the "noname" file and download it to my desktop, then open it in a text editor I see the HTML that was supposed to make up the body of the message. When looking at the raw headers of the email, they appear a little odd... in the header: Content-Type: multipart/alternative; boundary*="utf8''en''--==_mimepart_4dc028b2f0d86_2dc7800d21b03013b"; charset*=utf8''en''UTF-8 But then I see 3 boundaries, like so: ----==_mimepart_4dc028b2f0d86_2dc7800d21b03013b Date: Tue, 03 May 2011 12:09:22 -0400 Mime-Version: 1.0 Content-Type: text/plain; charset*=utf8''en''UTF-8 Content-Transfer-Encoding: 7bit Content-ID: <4dc028b2f392a_2dc7800d21b0302dc@Fleetwoods- Mac.local.mail> .... some plain text content (ommitted) ...... ----==_mimepart_4dc028b2f0d86_2dc7800d21b03013b Date: Tue, 03 May 2011 12:09:23 -0400 Mime-Version: 1.0 Content-Type: text/html; charset*=utf8''en''UTF-8 Content-Transfer-Encoding: 7bit Content-ID: <4dc028b38ae_2dc7800d21b03039e@Fleetwoods-Mac.local.mail> .... some HTML content (ommitted) .... ----==_mimepart_4dc028b2f0d86_2dc7800d21b03013b-- --utf8''en''--==_mimepart_4dc028b2f0d86_2dc7800d21b03013b-- -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
Jason FB
2011-May-04 23:33 UTC
Re: problems with ActionMailer & multipart emails, works in OS X Mail but not in other mail readers
I''ve identified the problem although I''m not sure where it is coming from. there appears to be a feature in Rails 3 that auto-detects UTF-8 characaters somewhere in your email and encodes your headers appropriately. When I started with a fresh Rails 3.0.7 project, I''m able to do the most simple html/plain email and get a content-type header that looks like this: Content-Type: multipart/alternative; boundary="-- ==_mimepart_4dc1cf5d84985_1fc7800d21b0517aa"; charset=UTF-8 I notice that these emails -- which work find in Gmail -- don''t have odd-looking =?UTF8?Q? symbols scattered throughout the headers Then, on my project which is already started, when I go to generate an email with what looks like is the exact same settings & content, I get this: Content-Type: multipart/alternative; boundary*="utf8''en''--==_mimepart_4dc1d4f8459fb_22ab800d21b083558"; charset*=utf8''en''UTF-8 It appears that something is malformed here, and Gmail is hiccuping on that weird-looking boundary marker I think. The trouble is, I''m not sure how to turn off the UTF-8 encoding thing or to keep it from kicking in. Actually I''m not sure what is making it kick in here and not on a brand new, from-scratch project. Still investigating, but is it these UTF markers inside the headers that seems to be causing the problem. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
Jason FB
2011-May-04 23:33 UTC
Re: problems with ActionMailer & multipart emails, works in OS X Mail but not in other mail readers
I''ve identified the problem although I''m not sure where it is coming from. there appears to be a feature in Rails 3 that auto-detects UTF-8 characaters somewhere in your email and encodes your headers appropriately. When I started with a fresh Rails 3.0.7 project, I''m able to do the most simple html/plain email and get a content-type header that looks like this: Content-Type: multipart/alternative; boundary="-- ==_mimepart_4dc1cf5d84985_1fc7800d21b0517aa"; charset=UTF-8 I notice that these emails -- which work find in Gmail -- don''t have odd-looking =?UTF8?Q? symbols scattered throughout the headers Then, on my project which is already started, when I go to generate an email with what looks like is the exact same settings & content, I get this: Content-Type: multipart/alternative; boundary*="utf8''en''--==_mimepart_4dc1d4f8459fb_22ab800d21b083558"; charset*=utf8''en''UTF-8 It appears that something is malformed here, and Gmail is hiccuping on that weird-looking boundary marker I think. The trouble is, I''m not sure how to turn off the UTF-8 encoding thing or to keep it from kicking in. Actually I''m not sure what is making it kick in here and not on a brand new, from-scratch project. Still investigating, but is it these UTF markers inside the headers that seems to be causing the problem. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
Jason FB
2011-May-05 20:43 UTC
Re: problems with ActionMailer & multipart emails, works in OS X Mail but not in other mail readers
Got the problem isolated down to one particular gem (Yes, I had to do a split-half search turning them off & on to figure this out). The conflict is with a gem called writeexcel. I have no idea what this is a conflict -- this gem has nothing to do with sending out mail and it is used in an unrelated part of my app, but as you an see, when this gem is activated I get this in the outgoing email header: <Content-Type: multipart/alternative; boundary=utf8''en''-- ==_mimepart_4dc305ed68008_8473800d21b024556; charset=utf8''en''UTF-8>, <Content-Transfer-Encoding: 7bit>> When uninstalled, I get this: <Content-Type: multipart/alternative; boundary="--==_mimepart_4dc3056f27a84_83df800d21b07422d"; charset=UTF-8>, <Content-Transfer-Encoding: 7bit>> As far as I can tell the latter one is the correct one, not the former one. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
Jason FB
2011-May-05 20:43 UTC
Re: problems with ActionMailer & multipart emails, works in OS X Mail but not in other mail readers
Got the problem isolated down to one particular gem (Yes, I had to do a split-half search turning them off & on to figure this out). The conflict is with a gem called writeexcel. I have no idea what this is a conflict -- this gem has nothing to do with sending out mail and it is used in an unrelated part of my app, but as you an see, when this gem is activated I get this in the outgoing email header: <Content-Type: multipart/alternative; boundary=utf8''en''-- ==_mimepart_4dc305ed68008_8473800d21b024556; charset=utf8''en''UTF-8>, <Content-Transfer-Encoding: 7bit>> When uninstalled, I get this: <Content-Type: multipart/alternative; boundary="--==_mimepart_4dc3056f27a84_83df800d21b07422d"; charset=UTF-8>, <Content-Transfer-Encoding: 7bit>> As far as I can tell the latter one is the correct one, not the former one. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.