diff options
| author | Vijay Dev <vijaydev.cse@gmail.com> | 2013-03-10 00:09:26 +0530 |
|---|---|---|
| committer | Vijay Dev <vijaydev.cse@gmail.com> | 2013-03-10 00:09:26 +0530 |
| commit | b938f08a3352981f9a2876a60ff2600438b771c2 (patch) | |
| tree | a4405b069c506366966bb261b45b1720026722ba /guides/source/action_mailer_basics.md | |
| parent | b3a31e936363472e7f9bf08cdb0d894127fbd753 (diff) | |
| parent | be3e402c79d5c1eac4729e2982d05161c1a9b6a2 (diff) | |
| download | rails-b938f08a3352981f9a2876a60ff2600438b771c2.tar.gz rails-b938f08a3352981f9a2876a60ff2600438b771c2.tar.bz2 rails-b938f08a3352981f9a2876a60ff2600438b771c2.zip | |
Merge branch 'master' of github.com:lifo/docrails
Diffstat (limited to 'guides/source/action_mailer_basics.md')
| -rw-r--r-- | guides/source/action_mailer_basics.md | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/guides/source/action_mailer_basics.md b/guides/source/action_mailer_basics.md index 8720aae169..31182e9aed 100644 --- a/guides/source/action_mailer_basics.md +++ b/guides/source/action_mailer_basics.md @@ -403,7 +403,7 @@ If you wish to override the default delivery options (e.g. SMTP credentials) whi ```ruby class UserMailer < ActionMailer::Base - def welcome_email(user,company) + def welcome_email(user, company) @user = user @url = user_url(@user) delivery_options = { user_name: company.smtp_user, password: company.smtp_password, address: company.smtp_host } @@ -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 achieve 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 ---------------- |
