Mailercloud Email API - Help Guide

Mailercloud provides an easy way to send emails programmatically using our Email API. This guide will help you understand how to use it effectively.

What is Mailercloud Email API?

The Mailercloud Email API allows you to send emails automatically from your application or website. You can define the sender, recipients, subject, email content, and even add attachments. This is useful for sending automated emails like order confirmations, password resets, or marketing emails.

How to Use the Email API?

To use this API, you need an API key for authentication.

API Endpoint

The API URL where you need to send the request:

POST https://email-api.mailercloud.com/email

Authentication

Include your API key in the request headers.

Content-Type: application/json
Authorization: Bearer YOUR_API_KEY

What Information is Required?

Parameter

Type

Description

email.from

String

Sender’s email address

email.fromName

String

Sender’s name

email.replyTo

Array

Reply-to email addresses

email.subject

String

Email subject

email.text

String

Plain text version of the email

email.html

String

HTML version of the email

email.recipients

Object

Contains recipient information (To, CC, BCC)

email.attachments

Array

Attach files to your email

metadata

Object

Custom metadata for tracking

Example of Sending an Email Using API

{
    "email": {
        "from": "support@yourcompany.com",
        "fromName": "Your Company",
        "replyTo": ["noreply@yourcompany.com"],
        "subject": "Welcome to Our Platform!",
        "text": "Hello John, welcome to our platform!",
        "html": "<h1>Hello John,</h1><p>Welcome to our platform!</p>",
        "recipients": {
            "to": [{"name": "John Doe", "email": "johndoe@example.com"}]
        }
    }
}

Understanding API Responses

Once you send a request, you will receive a response:

  • Success Response:

{
    "status": "success",
    "message_id": "xyz12345",
    "description": "Email sent successfully."
}
  • Error Response (e.g., Invalid Email):

{
    "status": "error",
    "error_code": 400,
    "message": "Invalid email address format"
}

Status Codes and Their Meaning

Status Code

Meaning

1000

Success

9001

Throttling error

9002

Message sending quota exceeded

9003

Authentication failure

9004

Recipient address not specified

9005

From field missing

9006

Soft bounce (temporarily deferred)

9007

Hard bounce

9008

Email reported as spam

9009

Email unsubscribed

9010

Email in suppression list

9011

Sender address not verified

9012

ESP rejected message

9013

Request to ESP expired

9014

ESP unavailable

9015

IP not whitelisted with ESP

9016

Subject field empty

9017

Invalid sender address

9018

Invalid email address

9019

Recipient's mailbox is full

9020

Error processing email at Private ESP

9021

Mailbox was not found on email server

9022

Unsupported or unknown version

9024

Authorization failure

9452

Message overloading

9512

Host email server not found

9999

Unknown error occurred


Did this answer your question?
😞
😐
😁