views:

365

answers:

2

I'd like to send plain text emails from a Rails app. In my mail sending config I have:

ActionMailer::Base.default_content_type = 'text/plain'

Nonetheless, when I send a test email from the Rails console, I get:

>> GeneralAppMailer.deliver_test

# ...

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

And looking at it in Gmail, it does seem to be handled as HTML.

+1  A: 

Without seeing the test method in your GeneralAppMailer class, it's impossible to say, but it's probably because you're rendering an HTML-based view template to send the message. But maybe you should post your code.

Jim Puls
+7  A: 

Be sure your template ends with .text.plain.erb extension and not .text.html.erb. See ActionMailer documentation.

Simone Carletti