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
Name | Type | Description |
---|---|---|
subject | String | Subject of the email |
to | String, Array of Strings | Can 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"] |
cc | String, Array of Strings | Same as to |
bcc | String, Array of Strings | Same as to |
props | Object | Template dynamic props |
attachments | Array | Each item can include:filename : file nametemplateId : a different template type : generate template as html/pdf/pngprops : the template's dynamic propscontent : if no type defined can create attachment from a stringpath : 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"
}]
}