Bamboo + Mailgun: not using CSS

Hey all,

I’m using Bamboo with Mailgun and I’m having trouble sending CSS-decorated emails. You can view my template here. For some reason, when my emails go through Mailgun, CSS, fonts and images are not getting picked up. The CSS is meant to come from another file priv/static/css/style.css, the font is declared inline and the images are also stored in priv/static.

Has anyone experienced this problem? Any ideas how I could resolve this?

Many thanks!

EDIT: I’ve tried Premailex but it didn’t help.

Email styling is hard. Check if your client support features you are using.

EDIT You also need to use absolute URLs, and from what I see you try to use relative ones.

2 Likes

Thanks for replying!

I’m not sure what you mean by checking if the client supports my features. Do you mean Mailgun?

As for the URLs, do you mean absolute paths on my local machine? That wouldn’t work because my API is sitting somewhere on a remote container. And it seems to work in dev mode.

When your user view the email in their email clients, they are not in your web application so you have to use absolute url, not just path, for all assets. Furthermore, an email client is not a browser and it may not support all the browser goodies and it would be dangerous otherwise.

Or you can have all the styles and fonts embedded in the email. It is harder but worries free

2 Likes

I’m still not sure about the absolute URLs. Would you suggest to move them to some location on my machine and then copy these files into the same directory on a server? Feels hacky.

As for embedding the styles into the email, that sounds like a solution until you try to include an image.

You can embed images as well. The absolute url is a must, there is no other way. Whatever you saw under the sent_mails route is not real; they are for debug and nothing else.

2 Likes

Great, thank you for the suggestion, I will give it a go!