Why should I specify a text format for creating a template using ActionMailer?

I am using ActionMailer 3.0.7

According to the docs, text email is standard. Therefore, if I have an InquiryNotifier mailer with a notification method, I expect it to display app/views/enquiry_notifier/notify.text.plain.erb.

If I just use the mail(someparams)notification method, the message body is empty.

I read that ActionMailer is designed to scan a view directory to search for all types of templates.

However, if I specify the format inside the block and do

mail(:to => 'somebody', :subject => 'something') do |format|
    format.text
end

then my template notify.text.plain.erbwill be displayed.

Perhaps it’s not connected: if I do not specify the format, but rename the template to notify.erb, then it works, but the message is sent as text / html.

+3
1

rails 3.0.6:

  • mailer, .
  • "notify.text.erb"
+5

All Articles