diff options
author | Mauro George <maurogot@gmail.com> | 2015-07-02 19:28:16 -0300 |
---|---|---|
committer | Mauro George <maurogot@gmail.com> | 2015-07-03 07:38:56 -0300 |
commit | 9cc438f5596a519bdccc36cd0763feb72040e45b (patch) | |
tree | 8783fda8c979b31512360241cd80a0c20ccb0e09 /guides | |
parent | cc7ef0cf19d9818c6772e77ca4a8d350688b44e8 (diff) | |
download | rails-9cc438f5596a519bdccc36cd0763feb72040e45b.tar.gz rails-9cc438f5596a519bdccc36cd0763feb72040e45b.tar.bz2 rails-9cc438f5596a519bdccc36cd0763feb72040e45b.zip |
Create Adding images in Action Mailer Views on guides
[ci skip]
Diffstat (limited to 'guides')
-rw-r--r-- | guides/source/action_mailer_basics.md | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/guides/source/action_mailer_basics.md b/guides/source/action_mailer_basics.md index 6f159b2fc4..c31b50fcfc 100644 --- a/guides/source/action_mailer_basics.md +++ b/guides/source/action_mailer_basics.md @@ -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 |