That all looks like it should work. If you're checking the mail in Gmail it won't render as html because you have an <html> and <body> tag included in the email. This is true for other web email clients as well since if you think about it, if you're viewing the email on the web the page will already have both of those tags and they're not supposed to be duplicated.
I'd try stripping your email down to only the content you want to display and trying it again. Gabriel On Dec 12, 12:42 am, "Matthew D." <[email protected]> wrote: > Sorry if this is totally basic for everyone but I'm not having luck > googling the answer. I'm new to Ruby, Rails, Heroku, etc. but eager to > learn quickly. > > I more or less followed the instructions at: > > http://docs.heroku.com/smtp > > I found mail wasn't sent until I added mail.deliver to the model > sample. I find that my email appears in text/plain only even though > I'm specifying a new_post.text.html.erb file. How do I get the mail to > be sent in text/html? The sample specified new_post.rhtml as the > filename but searches on other sites seem to suggest .text.html.erb > and .text.plain.erb are correct. I'm not clear on this. > > Here are my files based on the Getting Started blog sample: > > app/mailers/post_mailer.rb > > class PostMailer < ActionMailer::Base > > def new_post(post) > recipients "Matthew D. <[email protected]>" > from "[email protected]" > subject "#{post.name} made a post" > sent_on Time.now > body :post => post > end > end > > app/models/post.rb > class Post < ActiveRecord::Base > ... > after_create :deliver_new_post > def deliver_new_post > mail = PostMailer.new_post(self) > mail.deliver > end > end > > app/views/post_mailer/new_post.text.html.erb > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> > <html> > <head> > <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" /> > </head> > <body> > <h1>A new post was made by <%=h @post.name %></h1> > </body> > </html> > > How do I get the mail to be sent as text/html? -- You received this message because you are subscribed to the Google Groups "Heroku" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/heroku?hl=en.
