explaingit

gabrielperales/phoenix-email

Analysis updated 2026-05-18

18ElixirAudience · developerComplexity · 2/5Setup · easy

TLDR

An Elixir library, ported from react-email, for building HTML emails as Phoenix HEEx components with automatic table layout and inline styles.

Mindmap

mindmap
  root((PhoenixEmail))
    What it does
      HEEx email components
      Table-based HTML output
      Plain text rendering
    Tech stack
      Elixir
      Phoenix
      Tailwind CSS
      Swoosh
    Use cases
      Write emails as components
      Style with Tailwind
      Send via Swoosh
    Audience
      Elixir developers
      Phoenix developers

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Write transactional emails as Phoenix function components instead of hand-coded table HTML.

USE CASE 2

Render an email to both HTML and plain-text versions for multipart sending.

USE CASE 3

Style emails with Tailwind utility classes that get compiled to email-safe inline CSS ahead of time.

USE CASE 4

Send a rendered email directly through the Swoosh mailer integration.

What is it built with?

ElixirPhoenixHEExTailwind CSSSwoosh

How does it compare?

gabrielperales/phoenix-emailcaudena/beam_weaverelixir-vibe/vibe_kit
Stars182016
LanguageElixirElixirElixir
Setup difficultyeasymoderateeasy
Complexity2/54/52/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 30min

Tailwind class support requires running mix phoenix_email.tailwind and a resolvable tailwindcss binary.

In plain English

PhoenixEmail is a library for building HTML emails inside Elixir applications that use the Phoenix web framework, and it is a direct port of a popular JavaScript project called react-email. Instead of hand writing the table based HTML and inline styles that email clients like Gmail, Outlook, and Apple Mail require, you write emails as ordinary Phoenix function components using the same HEEx templating syntax Phoenix developers already use for web pages, and PhoenixEmail turns them into the table layouts, inline styles, and Outlook specific workarounds that make an email render consistently across clients. The library ships a set of ready made components covering the pieces a typical email needs: a root email wrapper, a hidden preview text element for inbox previews, containers and sections for layout, headings, paragraphs, links, buttons, images, dividers, code blocks, and even a markdown renderer. Each component accepts a style attribute written either as a plain CSS string or as a map or keyword list, and property names can be written in snake case, camelCase, or kebab case, which makes it easy to copy styles over from an existing react-email project. Numbers are automatically given pixel units except for properties like line height or opacity where that would not make sense. There is also support for Tailwind CSS utility classes on any visual component. Rather than compiling Tailwind on every email render, a separate command scans your source code ahead of time, runs the real Tailwind compiler, and converts the resulting CSS into a lookup table of email safe inline styles, so rendering an email with Tailwind classes becomes a simple lookup instead of an extra build step per email. Both Tailwind version 3 and version 4 are supported, including newer Tailwind 4 features like oklch colors and CSS calc based spacing. Once a component is written, it can be rendered to an HTML string or to a plain text version for email clients that prefer it, and there is an optional integration with the Swoosh mailer library to send the rendered result directly. Extra features like syntax highlighted code blocks and markdown rendering are optional and only activate if you add their small supporting libraries as dependencies.

Copy-paste prompts

Prompt 1
Add phoenix_email to my Phoenix app and build a welcome email component.
Prompt 2
Help me convert my existing react-email templates to PhoenixEmail HEEx components.
Prompt 3
Show me how to set up Tailwind classes with phoenix_email.tailwind for email-safe styling.
Prompt 4
Explain how PhoenixEmail generates the plain-text version of an email.

Frequently asked questions

What is phoenix-email?

An Elixir library, ported from react-email, for building HTML emails as Phoenix HEEx components with automatic table layout and inline styles.

What language is phoenix-email written in?

Mainly Elixir. The stack also includes Elixir, Phoenix, HEEx.

How hard is phoenix-email to set up?

Setup difficulty is rated easy, with roughly 30min to a first successful run.

Who is phoenix-email for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.