diff options
author | Nate Berkopec <nate.berkopec@gmail.com> | 2012-10-27 14:28:42 -0400 |
---|---|---|
committer | Nate Berkopec <nate.berkopec@gmail.com> | 2012-11-19 11:27:22 -0500 |
commit | 9cf33b55f39779b98604e1652affc2c64873dd9b (patch) | |
tree | b9ae97ade41b07a17e8f52d8e1194e96ac3d13be /guides/source | |
parent | 3b99653587cead2f8b6ba4ee163c8b736d5f7f34 (diff) | |
download | rails-9cf33b55f39779b98604e1652affc2c64873dd9b.tar.gz rails-9cf33b55f39779b98604e1652affc2c64873dd9b.tar.bz2 rails-9cf33b55f39779b98604e1652affc2c64873dd9b.zip |
Explicit multipart messages respect :parts_order
As issue #7978, the order in which ActionMailer
sends multipart messages could be unintentionally
overwritten if a block is passed to the mail
method. This changes the mail method such that
:parts_order is always respected, regardless of
whether a block is passed to mail.
Diffstat (limited to 'guides/source')
-rw-r--r-- | guides/source/action_mailer_basics.md | 18 |
1 files changed, 1 insertions, 17 deletions
diff --git a/guides/source/action_mailer_basics.md b/guides/source/action_mailer_basics.md index fb26a3a6a3..8687cfea52 100644 --- a/guides/source/action_mailer_basics.md +++ b/guides/source/action_mailer_basics.md @@ -377,23 +377,7 @@ If you use this setting, you should pass the `only_path: false` option when usin Action Mailer will automatically send multipart emails if you have different templates for the same action. So, for our UserMailer example, if you have `welcome_email.text.erb` and `welcome_email.html.erb` in `app/views/user_mailer`, Action Mailer will automatically send a multipart email with the HTML and text versions setup as different parts. -The order of the parts getting inserted is determined by the `:parts_order` inside of the `ActionMailer::Base.default` method. If you want to explicitly alter the order, you can either change the `:parts_order` or explicitly render the parts in a different order: - -```ruby -class UserMailer < ActionMailer::Base - def welcome_email(user) - @user = user - @url = user_url(@user) - mail(to: user.email, - subject: 'Welcome to My Awesome Site') do |format| - format.html - format.text - end - end -end -``` - -Will put the HTML part first, and the plain text part second. +The order of the parts getting inserted is determined by the `:parts_order` inside of the `ActionMailer::Base.default` method. ### Sending Emails with Attachments |