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.

Reply via email to