Send email

Send email through API

POST https://api.mailhub.sh/v1/send

Headers

NameValue

Content-Type

application/json

Authorization

Bearer <token>

Body

NameTypeRequiredComment

from

string

Yes

to

string | string[]

Yes

subject

string

Yes

bcc

string[]

No

cc

string[]

No

reply_to

string[]

No

code

string

Yes/No

Either code or layout_identifier are required

layout_identifier

string

Yes/No

Either code or layout_identifier are required Eg. tp-xxxxxx

text

string

No

tags

object[]

{
    name: string
}

No

language

string

No

Language code (eg. en, en_gb, en_au, ...) Documentation

attachments

object[]

{
    filename: string, // (optional)
    content: string | Buffer, //(optional)
    path: string, //(optional)
    contentType: string, //(optional)
}

No

Example

curl -X POST "https://api.mailhub.sh/v1/send" \
  --header "Authorization: Bearer <<YOUR_API_KEY_HERE>>" \
  --header "Content-Type: application/json" \
  --data '{
      "layout_identifier": "<<YOUR_LAYOUT_ID>>",
      "variables": {},
      "code": null,
      "from": "Example <example@your-domain.com>",
      "to": "example@mailhub.sh",
      "subject": "hello world",
      ...
  }'

Last updated