Skip to main content

From MJML

  1. Remove the mjml npm package and install @vuemaildev/vuemail
  2. Find all MJML templates ending with the .mjml extension and convert these to Vue single file components with the .vue extension.
  3. Replace MJML standard component tags with Vuemail component tags where possible, including <Text>, <Img>, <Button> etc.
  4. Convert custom MJML components with the .js extension to Vue components with the .vue extension.

From React Email

Vuemail is a port of React Email, so its components take the same props and render the same HTML. What changes is how emails are written: as Vue single file components instead of React components.
  1. Replace the React Email packages with the Vuemail ones, and React with Vue:
  2. Rewrite each email as a .vue file in your emails directory. Most of it maps one to one: Here’s an email written with Vuemail:
    emails/welcome.vue
  3. Keep a few differences in mind:
    • <style> tags can’t be written in Vue templates. Render them from <script setup> instead, with a small functional component: const Styles = () => h('style', { innerHTML: css }).
    • Numbers in style objects get px added on Vuemail components, like in React, but not on plain elements like <td> or <p>. Prefer strings with units, like '20px'.
    • defineOptions is hoisted out of <script setup>, so PreviewProps has to be written inline.
    • Importing .vue files needs a bundler that compiles them. See compiling emails.
Try adding these other components to your email.

Image

Display an image in your email.

Link

A hyperlink to web pages or anything else a URL can address.

Divider

Display a divider that separates content areas in your email.

Preview

A preview text that will be displayed in the inbox of the recipient.