I am trying to deploy an API with Heroku, using Elixir and Phoenix. In some use cases, I need to send an HTML email (that is all figured out and sending properly), however, images used on the email body are not being sent. This images are under: priv/static/images
.
On the email body I am using:
src="<%= Routes.static_url(@conn, "/images/logo-default.png") %>"
This works on development mode. Emails sent to localhost:4000/sent-emails
render with the images. But in production, the emails sent, arrive to mailbox without them.
If I lookup localhost:4001/images/logo-default.png
(running locally) or in Heroku https://agile-fortress-72183.herokuapp.com/images/logo-default.png
I can see the images. Either way none of them serves the images on email.
I'm not using a Phoenix buildpack because the only files I want to serve are this images to be part of email HTML body.
[UPDATE]
After a while, and some research I noticed that the email clients are blocking the images. So, how do I send an html body email with images, like the ones on newsletters and so. I am using Bamboo
adapter and Mailgun
to send the emails.
Any solutions to fix this problem?