mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Create Adding images in Action Mailer Views on guides
[ci skip]
This commit is contained in:
parent
cc7ef0cf19
commit
9cc438f559
1 changed files with 18 additions and 0 deletions
|
@ -533,6 +533,24 @@ url helper.
|
|||
NOTE: non-`GET` links require [jQuery UJS](https://github.com/rails/jquery-ujs)
|
||||
and won't work in mailer templates. They will result in normal `GET` requests.
|
||||
|
||||
### Adding images in Action Mailer Views
|
||||
|
||||
Unlike controllers, the mailer instance doesn't have any context about the
|
||||
incoming request so you'll need to provide the `:asset_host` parameter yourself.
|
||||
|
||||
As the `:asset_host` usually is consistent across the application you can
|
||||
configure it globally in config/application.rb:
|
||||
|
||||
```ruby
|
||||
config.action_mailer.asset_host = 'http://example.com'
|
||||
```
|
||||
|
||||
Now you can display an image inside your email.
|
||||
|
||||
```ruby
|
||||
<%= image_tag 'image.jpg' %>
|
||||
```
|
||||
|
||||
### Sending Multipart Emails
|
||||
|
||||
Action Mailer will automatically send multipart emails if you have different
|
||||
|
|
Loading…
Reference in a new issue