Has anyone gotten an html email to work at gmail.com? I have probably tried every combination under the sun. Can anyone who has gotten emails to correctly render in GMail post their actionmailer method call that sets the multipart content. I have seen many html formatted emails work in GMail so I know this can be done. -Aryk -- 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?hl=en -~----------~----~----~----~------~----~------~--~---
On Dec 19, 2006, at 10:09 PM, Aryk Grosz wrote:> Has anyone gotten an html email to work at gmail.com? I have probably > tried every combination under the sun. > > Can anyone who has gotten emails to correctly render in GMail post > their > actionmailer method call that sets the multipart content. > > I have seen many html formatted emails work in GMail so I know this > can > be done. > > -ArykIf you happen to be following the Rails Recipes for this, I ran into trouble until changing the name of the file from "multipart_alternative.rhtml" to "multipart_alternative_html.rhtml". There seemed to be a conflict between the content_type "multipart/ alternative" and the file-name-based magic of setting the content type. I think you can change the name to anything other than "multipart_alternative.rhtml" and get the same results. Look at the generated email and see if the HTML part is given a MIME type of "text/html" or "multipart/alternative". (I dealt with this months ago and don''t recall any more specifics.) -Rob # Recipe 67: # http://media.pragprog.com/titles/fr_rr/code/ GracefullyDegradingRichTextEmails/app/models/notifier.rb #--- # Excerpted from "Rails Recipes" # We make no guarantees that this code is fit for any purpose. # Visit http://www.pragmaticprogrammer.com/titles/fr_rr for more book information. #--- class Notifier < ActionMailer::Base def multipart_alternative(recipient, name, sent_at = Time.now) subject "Something for everyone." recipients recipient from ''barnam-Vm8wfZGX7qC+XT7JhA+gdA@public.gmane.org'' sent_on sent_at content_type "multipart/alternative" part :content_type => "text/plain", :body => render_message("multipart_alternative_plain", :name => name) part :content_type => "text/html", :body => render_message("multipart_alternative_html", :name => name) #...................................................^^^^^ end def implicit_multipart(recipient, name, sent_at = Time.now) subject "Something for everyone." recipients recipient from ''barnam-Vm8wfZGX7qC+XT7JhA+gdA@public.gmane.org'' sent_on sent_at body(:name => name) end end __END__ Rob Biedenharn http://agileconsultingllc.com Rob-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
Rob, Thanks for the post. Unfortunately, I tried the code from the recipes book and it does work. This is what I currently have: def invite(email, sender) subject sender.full_name + '' has invited you to Mixbook.com'' recipients email from ''invite-yyL2eFK7MhNBDgjK7y7TUQ@public.gmane.org'' sent_on Time.now content_type "multipart/alternative" # headers = {"MIME-Version"=>1.0} # body ''sender'' => sender part :content_type=> "text/plain", :body => render_message("invite_plain",:sender=>sender) part :content_type=> "text/html", :body => render_message("invite_html", :sender=>sender) end Bear in mind, that this works in outlook express, just not on GMail''s website. Am I somehow coding the email incorrectly. I include style information in the actual email because I don''t know where else to put it. I doubt that''s the problem though. -- 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?hl=en -~----------~----~----~----~------~----~------~--~---
AYYYYY.... I figured out what I was doing wrong. Gmail strips your html code of all id and class tags along with stylesheets if you those. You also cant float divs. You need to use archaic tables when dealing with gmail and most other clients. -- 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?hl=en -~----------~----~----~----~------~----~------~--~---