aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source/action_mailer_basics.md
diff options
context:
space:
mode:
authorFabrizio Regini <freegenie@gmail.com>2013-03-08 23:29:58 +0100
committerFabrizio Regini <freegenie@gmail.com>2013-03-08 23:29:58 +0100
commit1fe5d36e11275a658d4503eda183dcb31b78380a (patch)
tree8452479d7a4bbe14482e0c65eaa7f14af32ab7c7 /guides/source/action_mailer_basics.md
parent4314d2bbb20013eefef1e52b2f57316f42c3b734 (diff)
downloadrails-1fe5d36e11275a658d4503eda183dcb31b78380a.tar.gz
rails-1fe5d36e11275a658d4503eda183dcb31b78380a.tar.bz2
rails-1fe5d36e11275a658d4503eda183dcb31b78380a.zip
Adding a note for :body option in `mail` method.
Diffstat (limited to 'guides/source/action_mailer_basics.md')
-rw-r--r--guides/source/action_mailer_basics.md13
1 files changed, 13 insertions, 0 deletions
diff --git a/guides/source/action_mailer_basics.md b/guides/source/action_mailer_basics.md
index 8720aae169..772b143f8c 100644
--- a/guides/source/action_mailer_basics.md
+++ b/guides/source/action_mailer_basics.md
@@ -412,6 +412,19 @@ class UserMailer < ActionMailer::Base
end
```
+### Sending Emails without Template Rendering
+
+There may be cases in which you want to skip the template rendering step and supply the email body as a string. You can achive this using the `:body` option.
+In such cases don't forget to add the `:content_type` option. Rails will default to `text/plain` otherwise.
+
+```ruby
+class UserMailer < ActionMailer::Base
+ def welcome_email(user,email_body)
+ mail(to: user.email, body: email_body, content_type: "text/html", subject: "Already rendered!")
+ end
+end
+```
+
Receiving Emails
----------------