Hi how can we add image from my assets to the email like my logo when sending email to the users.
You should just be able to use the regular old
<%= image_tag("logo.png") %> helpers just like you would use in your views. You may need to set your asset_host so that it includes a full URL for the images in the emails since they aren't displayed in the browser under your domain.
# I believe these should do the trick: config.action_controller.asset_host = 'http://localhost:3000' config.action_mailer.asset_host = config.action_controller.asset_host
@chris I use that approach but that get me another error.
Font from origin has been blocked from loading by Cross-Origin Resource Sharing policy
The email show the logo but now fonts are missing.
has I'm using subdomain
Oh fun, CORS is not a super fun thing to mess with. I'm not sure if you can do that with email, but you have to allow origins with CORS to determine where your fonts can be loaded from: http://stackoverflow.com/questions/27726802/css-font-being-blocked-from-cross-origin-resource-sharing-policy
O yes, I start reading about CORS but looks to shallow for me at the moment. As the problem with the fonts is on my site and not in the email. If I disable the image on email and hide the config for that all goes back to normal. So yes need to do a workaround the email images and the font cross site.
Join 27,623+ developers who get early access to new screencasts, articles, guides, updates, and more.