Upgrade to Pro — share decks privately, control downloads, hide ads and more …

HTML Email in the React World

Sponsored · SiteGround - Reliable hosting with speed, security, and support you can count on.

HTML Email in the React World

In our company we send out plenty of HTML emails per day, over a dozen different layouts. Here's how we're getting a handle of it with React (as a rendering engine), and how is given us a better and more consistent layout system. On top of React emails we set out to create a great developer experience for our teams.

Avatar for Luis Merino

Luis Merino

April 20, 2017
Tweet

Other Decks in Programming

Transcript

  1. We are dependant on CSS+HTML support • We’ve been sending

    HTML in emails for about 2 decades • In 1997 HTML4 was released; in 1999 Outlook came to life
  2. HTML status-quo in Email clients • Apple iPhone: no support

    for max-width in media queries • Gmail : preprocesses to strip out any code that could be insecure • Google Android: lack of support of CSS and Gmail lacks media-queries • Outlook: TL;TR • ( here be dragons )
  3. Global Email Client Market Share • Apple iPhone 31% •

    Gmail 20% • Apple iPad 11% • Google Android 10% • Apple Mail 7% • Outlook 6% • Outlook.com 5% • Yahoo! Mail 2% • Windows Mail 1%
  4. “Faster Email Development Time” • Resources and know-how: blog, CampaignMonitor

    • Use responsive email frameworks: Foundation for Emails, MJML • Use testing tools: Litmus instant API
  5. Logo / Header Something interesting happened: Make research open to

    a ! We are changing how scienti " c knowledge is shared and discovered. - Unsubscribe link. - Footer, disclamer, legal notes. HeaderModule AvatarModule CustomItemModule FooterModule
  6. Building a guarantor system • Writing JS via JSX ensures

    no malformed HTML • Virtual DOM allows server side rendering • Component philosophy: reuse and update common styles • PropType validation help notify the developer of mistakes
  7. Building with React • Advantages: ⁃ Simple, explicit and modular

    ⁃ Ability to configure component output ⁃ Automatic inline of styles ⁃ Able to use with bundler (webpack) ⁃ Existing solutions in and out of RG (npm)
  8. Building with React • Drawbacks: ⁃ React only supports HTML5

    tags and attributes ⁃ React mounts to an element ⁃ React provides helpful warnings for a modern website
  9. Oy-vey “Oy provides the tools necessary to fill the gaps

    that React can’t (and probably shouldn’t) to help us render email templates on the server” github.com/revivek/oy
  10. Design Principles • Provide a great developer experience • Easy

    and predictable API • Means for reliable layout construction • Visual Testing: Litmus instant preview
  11. Design Principles • Desired Outcome: ⁃ No more black box

    development ⁃ Easy construction via components ⁃ Deal with garbage table code only once ⁃ Ensured level of consistency
  12. MailModule PHP Renderer V8 Renderer Output Broken HTML File Litmus

    screenshots Entry Point start <…> <html> end ? Black box
  13. Visual Output JS Dev Server MailModule V8 Renderer HTML Source

    Litmus screenshots start <…> <html> end √ Feedback: HMR, warnings, stacktrace… Entry Point
  14. type: Table ce!spacing: 0 ce!padding: 0 border: 0 type: Button

    width: ‘fu!’ theme: ‘solid’ width: 100% background: nova-blue-600 type: TR type: TD
  15. type: Button CTA Text width: ‘fu!’ theme: ‘solid’ children: ‘CTA…’

    <Button width=“full” href=“resea….com”>CTA Text</Button>