0
votes

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?

1
- can you give part of the email HTML code received ? ā€“ TheSquad
- Are you sure the image is not loading up because your email client blocks it ? ā€“ TheSquad
@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

1 Answers

1
votes

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.