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.


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?

  • - can you give part of the email HTML code received ? – TheSquad Aug 14 '19 at 9:34
  • - Are you sure the image is not loading up because your email client blocks it ? – TheSquad Aug 14 '19 at 9:35
  • @TheSquad after a while I noticed that it is probably the email client that is blocking the images like you said. I’m going to update my question. – zediogoviana Aug 14 '19 at 10:22

Unfortunately because the email client is the decision point there isn't too much you can do. Your best bet would be to ask your recipients to whitelist your email address.

  • I came to conclusion that in some email client the images are blocked by default, but others load by default. So, you're right, there is nothing I can do, it depends on the email client used. – zediogoviana Aug 15 '19 at 15:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.