danschultzer
Pow Core Team
I needed something like premailer for rails, and after searching, I decided to make an easy-to-use library to handle inline styles and convert to text for emails. It’s straightforward, and it handles external stylesheets too!
Here’s an example with Bamboo using a Phoenix template:
def welcome_email do
new_email
|> subject("Email subject")
|> to("test@example.com")
|> from("test@example.com")
|> put_text_layout(false)
|> render("email.html")
|> premail()
end
defp premail(email) do
html = Premailex.to_inline_css(email.html_body)
text = Premailex.to_text(email.html_body)
email
|> html_body(html)
|> text_body(text)
end
I hope some of you’ll find this library useful!
Trending in Announcing
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
In 2021 I started a new library called Tempo with the objective of modelling time as a set of intervals - not as instants. In 2022 I gave...
New
Hello,
I’m sharing my plugin here in forum after some time so it has time to mature and proof yourself.
I use Claude Code daily on a pr...
New
Aloha gang,
There’s a new class of AI model out from TypeSafe. Jev is their flagship model. You can learn about it here:
...
New
I’ve recently created a small library phoenix_vite integrating the vite build tooling with phoenix.
It
provides an igniter.installer t...
New
I needed something like premailer for rails, and after searching, I decided to make an easy-to-use library to handle inline styles and co...
New
If you’ve ever had to debug a BEAM node you know it can be a painful process. Parsing raw data, or dealing with clutter often gets in the...
New
Other Trending Topics
Hey there,
I haven’t seen a list of useful Elixir specific skills for the popular AI tools yet so I’m starting one here with my first.
...
New
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
(I just needed to vent somewhere and LinkedIn is full of hope, or hype, I’m not sure which exactly)
AI dream has many faces, but general...
New
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself.
My main conc...
New
Fly’s CEO posted this recently - Turn And Face The Strange · The Fly Blog
It says that Fly is going all-in on sprites, which is a worry ...
New
Code BEAM Europe 2026 – Call for Talks is Open!
We’re excited to announce that Code BEAM Europe 2026 is now open for talk submissions :t...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #ai
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #blog-post
- #ecto-query
- #elixirconf-us
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #elixirconf-eu
- #api
- #forms
- #security
- #hex











Showing Posts 1 to 4- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
ragamuf
Much appreciated.
danschultzer
Premailex v1.0!
Reached a huge milestone that finally got Premailex to a place I wanted it to be since first release, mainly:
:xmerlfallback for HTML parsing if none of LazyHTML, Floki, Meeseeks are availableA bunch of other changes have gone into it and applying inline styles is now typically 30x+ faster. Many more changes in the changelog.
mudasobwa
As a person who literally hates receiving emails in HTML, I am to suggest you to take a look at
marcliwhich can be used to produce kinda formatted text messages out of a markdown template.Actually, a support for markdown templates for HTML body might be a good addition to the library, too.
danschultzer
Yeah, HTML emails should always have plaintext alternatives. Premailex converts HTML to plaintext so you don’t have to maintain two versions yourself.
marclilooks cool, but not sure how markdown templates would fit in Premailex. Premailex is for processing already rendered HTML emails to ensure it can render correctly in email clients as well as producing plaintext alternative.Over the years I have attempted different versions of mail templates in Phoenix and HTML is the simplest. Most recently it’s just been something like this:
With the
mail.html.heexroot template undercomponents/layoutsand everything else undermailers/. The root template has all styling in the style tag in<head>.Markdown → HTML email would probably fit in this setup as well with Premailex used to ensure the rendered HTML has the applied inline styles.