Ruby-on-rails – How to send plaintext instead of HTML email from Rails

emailrubyruby-on-rails

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.

Best Solution

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