mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Adding a note for :body option in mail
method.
This commit is contained in:
parent
4314d2bbb2
commit
1fe5d36e11
1 changed files with 13 additions and 0 deletions
|
@ -412,6 +412,19 @@ class UserMailer < ActionMailer::Base
|
||||||
end
|
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
|
Receiving Emails
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue