Email API

The endpoint allows you to start sending emails through Mailazy Email API.


Send Email

Sends email via the REST API interface. Pass the components of the messages such as To, From, Subject as JSON payload.

Endpoint:

https://api.mailazy.com/v1/mail/send

JSON Payload:

FieldDescriptionTypeSample Value
toEmail address of the recipient(s)Array<String>["[email protected]"]
fromEmail address of the senderString"Sender <[email protected]>"
reply_toReply to addressString"Sender <[email protected]>"
subjectEmail subjectString"Hello, World!"
contentEmail contentArray<Object>[{"type": "text/plain", "value": "<Content>"},{"type": "text/html", "value": "<Content>"}]
attachmentsEmail AttachmentsArray<Object>[{"type": "application/pdf", "file_name": "invoice.pdf", "content": "<base64-encoded-file>"}]

Examples:

Send Email with HTML and Text Content
curl --location --request POST 'https://api.mailazy.com/v1/mail/send' \
    --header 'X-Api-Key: <API KEY>' \
    --header 'X-Api-Secret: <API SECRET>' \
    --header 'Content-Type: application/json' \
    --data-raw '{
        "to" : ["[email protected]"],
        "from": "Sender <[email protected]>",
        "subject": "Hello, World!",
        "content": [{
            "type": "text/plain",
            "value": "Hey! ....."
        },{
            "type": "text/html",
            "value": "Hey! ....."
        }]
    }'
Send Email with HTML and Text Content and Attachments

To send multiple attachments, it can be passed as an array of attachment objects encode as a base64 string.

curl --location --request POST 'https://api.mailazy.com/v1/mail/send' \
    --header 'X-Api-Key: <API KEY>' \
    --header 'X-Api-Secret: <API SECRET>' \
    --header 'Content-Type: application/json' \
    --data-raw '{
        "to" : ["[email protected]"],
        "from": "Sender <[email protected]>",
        "subject": "Hello, World!",
        "content": [{
            "type": "text/plain",
            "value": "Hey! ....."
        },{
            "type": "text/html",
            "value": "Hey! ....."
        }],
        "attachments": [{
            "type": "application/pdf",
            "file_name": "example.pdf",
            "content": "<base64-encoded-file>"
        }]
    }'