Send emails to users from your workspace.
URL | Requires Auth | HTTP Method |
---|---|---|
/api/v1/mailer |
yes |
POST |
Argument | Example | Required | Description |
---|---|---|---|
X-User-Id | myuser-name | Required | The authenticated user ID. |
X-Auth-Token | myauth-token | Required | Auth token. |
Argument | Example | Required | Description |
---|---|---|---|
from | test.funke@test.com | Required | A valid email address to send mails from. |
subject | Welcome to the Test Newsletter | Required | The subject of the email. |
body | Today's newsletter is for our new users. Kindly click [unsubscribe] to unsubscribe from this newsletter. | Required | The body of the email.You must use [unsubscribe] for the unsubscription link. You may use [name] , [fname] , [lname] for the user's full name, first name or last name, respectively. You may use [email] for the user's email. |
dryrun | true | Required | A boolean value. If true, will only send one email to the same address as in the From parameter. |
curl --location 'http://localhost:3000/api/v1/mailer' \
--header 'x-auth-token: 1C9ajI4zUSlsefEchqaBesENo9Hw7Qa-Vh9x3VrS1iQ' \
--header 'x-user-id: rbAXPnMktTFbNpwtJ' \
--header 'Content-Type: application/json' \
--data-raw '{
"from":"test.funke@test.com",
"subject":"Welcome to the Test Newsletter",
"body":"Thank you for subscribing to the Test Newsletter. If this was not you feelfree to unsubscribe by hitting the following button [unsubscribe]"
}'
{
"success": true
}
The following errors can occur upon the endpoint.
- Authorization: Requires an authentication token for the request to be made.
- Invalid From Address: The
from
parameter was be a valid email address.
{% tabs %} {% tab title=" Authorization" %}
{
"status": "error",
"message": "You must be logged in to do this."
}
{% endtab %}
{% tab title="Invalid From Address" %}
{
"success": false,
"error": "Invalid from address [error-invalid-from-address]",
"errorType": "error-invalid-from-address",
"details": {
"function": "Mailer.sendMail"
}
}
{% endtab %} {% endtabs %}
Version | Description |
---|---|
5.4.0 | Added |