Forum: Ruby on Rails How to send html formated messages through E-mail?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Prashant T. (Guest)
on 2006-06-09 10:47
Hi,

I want to send mail trough my rails application. Currently I am able to
send messages with content-type="text/plain". But when I am trying to
send messages in html format, the recepient receives messages but it's
in the plain text format with heml tags also gets displayed in ythe
message.
How to avoid it? & how to send html message through my application?

Please help me.(I am using Actionmailer for sending mails...)

Thanx
Pras
Michel D. (Guest)
on 2006-06-09 11:10
Most likely you need the following line, in your method
in the ActionMailer (models)

content_type  "text/html"

for example:

  def activate(account)
    @subject          = 'Subject'
    @recipients       = account.email
    @from             = 'removed_email_address@domain.invalid'
    @body['account']  = account
    content_type  "text/html"                     <--
  end

hope it works for you,
micheldogger
This topic is locked and can not be replied to.