aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source/action_mailer_basics.md
diff options
context:
space:
mode:
authorRobin Dupret <robin.dupret@gmail.com>2013-06-29 16:00:54 +0200
committerRobin Dupret <robin.dupret@gmail.com>2013-06-29 19:14:09 +0200
commit59efb76306e80e01783fa8ca458bf6e316d1305b (patch)
tree4adbf98812d68d843d9b5512c475f46d33deb457 /guides/source/action_mailer_basics.md
parent3e0ce665e537d3f1f444a0221456de19eb92882f (diff)
downloadrails-59efb76306e80e01783fa8ca458bf6e316d1305b.tar.gz
rails-59efb76306e80e01783fa8ca458bf6e316d1305b.tar.bz2
rails-59efb76306e80e01783fa8ca458bf6e316d1305b.zip
Remove a duplicated section [ci skip]
Attachments were previously covered so remove the useless part. Just move a note about multipart headers set when the mail method is triggered to the kept section.
Diffstat (limited to 'guides/source/action_mailer_basics.md')
-rw-r--r--guides/source/action_mailer_basics.md25
1 files changed, 5 insertions, 20 deletions
diff --git a/guides/source/action_mailer_basics.md b/guides/source/action_mailer_basics.md
index d1dd231cf6..d420365ec0 100644
--- a/guides/source/action_mailer_basics.md
+++ b/guides/source/action_mailer_basics.md
@@ -216,6 +216,11 @@ Action Mailer makes it very easy to add attachments.
attachments['filename.jpg'] = File.read('/path/to/filename.jpg')
```
+ When the `mail` method will be triggered, it will send a multipart email with
+ an attachment, properly nested with the top level being `multipart/mixed` and
+ the first part being a `multipart/alternative` containing the plain text and
+ HTML email messages.
+
NOTE: Mail will automatically Base64 encode an attachment. If you want something
different, encode your content and pass in the encoded content and encoding in a
`Hash` to the `attachments` method.
@@ -451,26 +456,6 @@ 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.
-### Sending Emails with Attachments
-
-Attachments can be added by using the `attachments` method:
-
-```ruby
-class UserMailer < ActionMailer::Base
- def welcome_email(user)
- @user = user
- @url = user_url(@user)
- attachments['terms.pdf'] = File.read('/path/terms.pdf')
- mail(to: @user.email,
- subject: 'Please see the Terms and Conditions attached')
- end
-end
-```
-
-The above will send a multipart email with an attachment, properly nested with
-the top level being `multipart/mixed` and the first part being a
-`multipart/alternative` containing the plain text and HTML email messages.
-
### Sending Emails with Dynamic Delivery Options
If you wish to override the default delivery options (e.g. SMTP credentials)