Skip to main content

SMTP

Profile Requirements

To deliver a message to a recipient over SMTP, Courier must be provided the recipient's email address. This value should be included in the recipient profile as email.

JSON
{
"message": {
// Recipient Profile
"to": {
"email": "example@example.com"
}

// ... rest of message definition
}
}

Override

Message Override

You can use a provider override to replace what we send to SMTP using NodeMailer. For example, you can add an attachment to your request:

JSON
{
"message": {
"template": "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
"to": {
"email": "example@example.com"
},
"providers": {
"smtp": {
"override": {
"body": {
"attachments": [
{
"filename": "text1.txt",
"content": "aGVsbG8gd29ybGQh",
"encoding": "base64"
}
]
}
}
}
}
}
}

Everything inside of message.providers.smtp.override.body will replace what we send using NodeMailer. You can see all the available options by visiting the NodeMailer docs.

Transport Override

You may also override the SMTP transport configuration using values passed to message.providers.smtp.override, like so:

JSON
{
"message": {
"template": "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
"to": {
"email": "example@example.com"
},
"providers": {
"smtp": {
"override": {
"config": {
"auth": {
"user": "username",
"pass": "hunter2"
},
"host": "smtp.example.com",
"secure": true,
"port": 465
}
}
}
}
}
}
Was this helpful?