Skip to content
This repository has been archived by the owner on Jun 27, 2024. It is now read-only.

Latest commit

 

History

History
77 lines (58 loc) · 3.13 KB

File metadata and controls

77 lines (58 loc) · 3.13 KB

Send Mailer Endpoint

Send emails to users from your workspace.

URL Requires Auth HTTP Method
/api/v1/mailer yes POST

Headers

ArgumentExampleRequiredDescription
X-User-Idmyuser-nameRequiredThe authenticated user ID.
X-Auth-Tokenmyauth-tokenRequiredAuth token.

Body Parameter

ArgumentExampleRequiredDescription
fromtest.funke@test.comRequiredA valid email address to send mails from.
subjectWelcome to the Test NewsletterRequiredThe subject of the email.
bodyToday's newsletter is for our new users.
Kindly click [unsubscribe] to unsubscribe from this newsletter.
RequiredThe 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.
dryruntrueRequiredA boolean value. If true, will only send one email to the same address as in the From parameter.

Example Call

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]"

}'

Example Result

Success

{
    "success": true
}

Errors

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 %}

Change Log

Version Description
5.4.0 Added