A New Way to Build Emails

Email HTML is notoriously painful. Every client renders differently. Inline styles are mandatory. Tables are the only reliable layout mechanism. And testing across Gmail, Outlook, Apple Mail, and dozens of other clients is a nightmare.

HtmlForgeX.Email takes that pain away. The same fluent C# API you know from HtmlForgeX, now purpose-built for email.

What's Included

HtmlForgeX.Email ships with 127+ typed components , all designed for email-client compatibility:

  • Layout components : Rows, columns, sections, spacers — all table-based under the hood
  • Text components : Headings, paragraphs, links with proper styling fallbacks
  • Interactive elements : Buttons with VML fallbacks for Outlook, OTP code displays
  • Utility cards : Product cards, receipt cards, profile cards, and 60+ pre-built templates
  • Charts : Inline SVG charts that render in email clients
  • Attachments : ICS calendar events, VCard contacts, embedded images with MIME encoding

Dark Mode Support

HtmlForgeX.Email generates both light and dark mode styles using @media (prefers-color-scheme: dark) . For clients that don't support media queries, the light theme serves as the graceful fallback.

Outlook VML Fallbacks

Outlook desktop uses the Word rendering engine, which doesn't support many CSS features. HtmlForgeX.Email automatically generates VML (Vector Markup Language) fallbacks for buttons, background images, and rounded corners.

Getting Started

Install the package:

dotnet add package HtmlForgeX.Email

Create your first email:

var email = new Email();
email.WithThemeMode(EmailThemeMode.Auto);
email.Body.EmailBox(box => {
    box.EmailHeading("Welcome aboard!", 1);
    box.EmailText(text => text.Text("Thanks for signing up. Here's what to do next."));
    box.EmailButton(button => {
        button.WithText("Get Started")
              .WithHref("https://example.com/start")
              .WithStyle(EmailButtonStyle.Primary);
    });
});

var result = await email.RenderAsync();
string html = result.Html;

Check out the full documentation to explore all components and features.