Forum: Ruby on Rails ActionMailer seems to ignore content-type specification

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.
6a32468b481d051898ae5843a9e7ad8c?d=identicon&s=25 Elliott B. (eblatt)
on 2006-12-29 16:59
Hi,

My employer would like me to send and html formatted email (Ugh!).
This seems easy enough...I thought I'd just change:

@headers['Content-Type']= "text/plain;
charset=#{UserSystem::CONFIG[:mail_charset]}; format=flowed"

to

@headers['Content-Type']= "text/html;
charset=#{UserSystem::CONFIG[:mail_charset]}; format=flowed"


After restarting and running, the log still shows:

Content-Type: text/plain; charset=utf-8

Not text/html, as I would have liked. And the markup does appear in the
email body, contrary to my wishes.

Any ideas?

Elliott
6a32468b481d051898ae5843a9e7ad8c?d=identicon&s=25 Elliott B. (eblatt)
on 2006-12-29 17:40
I got it.  I re-read the doc, and found that I needed to do this:

content_type  "text/html; charset=#{UserSystem::CONFIG[:mail_charset]};
format=flowed"

rather than this

@headers['Content-Type']=
"text/html;charset=#{UserSystem::CONFIG[:mail_charset]}; format=flowed"

Elliott Blatt wrote:
> Hi,
>
> My employer would like me to send and html formatted email (Ugh!).
> This seems easy enough...I thought I'd just change:
>
> @headers['Content-Type']= "text/plain;
> charset=#{UserSystem::CONFIG[:mail_charset]}; format=flowed"
>
> to
>
> @headers['Content-Type']= "text/html;
> charset=#{UserSystem::CONFIG[:mail_charset]}; format=flowed"
>
>
> After restarting and running, the log still shows:
>
> Content-Type: text/plain; charset=utf-8
>
> Not text/html, as I would have liked. And the markup does appear in the
> email body, contrary to my wishes.
>
> Any ideas?
>
> Elliott
This topic is locked and can not be replied to.