Transactional emails
The Transactional Email object represents a transactional email template in your Go-Mailer account. The API lets you send it to your recipients from your application.
Send an email
Sends the specified transactional email to the specified recipient. The recipient doesn't have to be a contact in your account.
https://api.go-mailer.com/v1/transactionalsRequest body
| Parameter | Type | Required | Description |
|---|---|---|---|
template_code | string | Required | The transactional template's unique code. |
recipient_email | string | Required | The recipient's email address. |
bcc | string | Optional | An email address to blind copy. |
html | string | Optional | A valid HTML document, if you want to use your own pre-built markup as the email content. It overrides the design you created in your Go-Mailer account. |
data | object | Optional |
Each key is the placeholder's name. If your template uses |
attachments | object[] | Optional | A list of attachments to send with the email. Each attachment must be no larger than 1MB. |
attachment.filename | string | Optional | The attachment's name, as the recipient will see it. |
attachment.path | string | Optional | A link to the file, if the attachment is hosted on a remote server. |
attachment.content | string | Optional | A base64 representation of the attachment. Best when the file isn't hosted remotely. |
attachment.contentType | string | Optional | The attachment's MIME type. Supported values include |
attachment.encoding | string | Optional | The attachment's content encoding. This should be |
Sample request
const response = await fetch("https://api.go-mailer.com/v1/transactionals", {
method: "POST",
headers: {
Authorization: "Bearer <API_KEY>"
},
body: JSON.stringify({
template_code: "BIRTHDAY_EMAIL",
recipient_email: "johndoe@example.com",
bcc: "admin@my-company.com",
data: {
firstname: "John",
age: 47,
},
attachments: [{
filename: "yourfile.pdf",
path: "https://path/to/file",
}]
})
});