问题
I am sending emails using the mailgun library in Phoenix. Turns out that when i look at the email in my gmail account, it has been stripped off of all the css classes and the link to external css files.
Mailgun suggests using a css inline library http://blog.mailgun.com/transactional-html-email-templates/
Tried search a lot, but could not find a css inline library for Phoenix/Elixir like the premailer gem in Ruby. Does anyone know of a way to achieve this?
回答1:
I just released Smoothie, an Elixir library that does just this. We use this in our product at the startup I run, and decided to write our own library as we also couldn't find one in the elixir ecosystem yet. Check out the github page for installation instructions. Let me know if it works for you!
回答2:
I have not been able to find anything myself but I believe you can find tools for that online and use them, it's not exactly the same but I guess it's better than to inline everything manually. For instance, you could use this one. I have not tested it though.
Also you can create a package yourself and share it with us :)
回答3:
There is also a library now called premailex which was released October 2017. It handles CSS inlining
来源:https://stackoverflow.com/questions/34085757/elixir-phoenix-inlining-css-for-sending-emails