Muil

Muil

  • Docs
  • Configurations
  • API
  • Blog

›API

Getting Started

  • Quick Start Guide
  • Slow Start Guide
  • Run Templates Viewer
  • Write Template
  • Styling Template
  • Solutions
  • Why Muil

Configurations

  • CLI
  • Custom Webpack Config
  • Custom Babel Config

API

  • Authorization
  • Sending Email
  • Generating PDF
  • Generating Image
  • Generating HTML

Email Limitations

  • Fonts
  • SVG

Components

  • Intro
  • Grid
  • Style
  • Alignment
  • Typography
  • Button
  • Callout
  • Menu
  • Spacer
  • Wrapper
  • Charts
  • PDF Page

Sending Email

Don't forget to add authorization header. Read More.

API

POST:
https://app.muil.io/templates/[branch]/[templateID]/email

Branch is optional

Parameters

NameTypeDescription
subjectStringSubject of the email
toString, Array of StringsCan be either:
string "example@muil.io"
string with semicolon delimiter "example1@muil.io;example2@muil.io"
array of strings ["example1@muil.io", "example2@muil.io"]
ccString, Array of StringsSame as to
bccString, Array of StringsSame as to
propsObjectTemplate dynamic props
attachmentsArrayEach item can include:
filename: file name
templateId: a different template
type: generate template as html/pdf/png
props: the template's dynamic props
content: if no type defined can create attachment from a string
path: if no type defined can create attachment from a url

Example

{
    "subject": "Test Subject",
    "to": "email1@muil.io",
    "cc": "email2@muil.io",
    "bcc": "email3@muil.io",
    "props": {
        // template dynamic props
    }
}

Attachments Example - Template

You can add attachments to the email based on other templates:

{
    "subject": "Test Subject",
    "to": "email@muil.io",
    "props": {
        // template dynamic props
    },
    attachments: [{
      "filename": "test",
      "templateId": // templateID
      "type": [html/pdf/png]
      "props": {
        // template dynamic props
      }
    }]
}

NOTE: Attachments must be one of the following: HTML/PDF/PNG

Attachments Example - Content

You can add attachments to the email based on text:

{
    "subject": "Test Subject",
    "to": "email@muil.io",
    "props": {
        // template dynamic props
    },
    attachments: [{
      "filename": "test",
      "content": "Hello World!"
    }]
}

Attachments Example - Path

You can add attachments to the email based on external file:

{
    "subject": "Test Subject",
    "to": "email@muil.io",
    "props": {
        // template dynamic props
    },
    attachments: [{
      "filename": "test",
      "path": "https://raw.githubusercontent.com/muil-io/viewer/master/README.md"
    }]
}

Limitations

Read More.

← AuthorizationGenerating PDF →
  • API
  • Parameters
    • Example
    • Attachments Example - Template
    • Attachments Example - Content
    • Attachments Example - Path
  • Limitations
Copyright © 2021 muil