Email Send Overview

What is Email Send API?

The MainBrainer Email Send API helps you programmatically send emails from your web application to your subscribers' email addresses. The Send API uses HTTP verbs and a RESTful endpoint structure to ensure flexibility and scalability for our customers.

How to use the Email Send API to send emails?

Step 1: Create a free account on MainBrainer.com.

Create your account on MainBrainer. Log into your account and get your account’s private token from the Account Configuration menu.

Step 2: Send your first email using the Send Email API

To help you get started, use the following Send Email API endpoint to send a test email from your web application. It will help you get familiarized with the MainBrainer email sending procedure.

Copy
Copied
Endpoint: https://apiemail.mainbrainer.com/index.html#
Note

To know more about how the email sending procedure works on MainBrainer, please refer to our Knowledge base articles on the same.

Step 3: Enter the relevant sending details as parameters in your API call.

When creating a new email via the API, enter the sending details as the following parameters in your API call.

  • Sender Name - Use this parameter to specify the name you want to display as the email's sender name. This name helps the email recipients identify who sent them the email.
  • Sender Email - Use this parameter to specify the email address you want to display as the sender address for the email. By default, you can only use noreply@mainbrainer.com as the sender email for your emails.
  • Reply to email - Use this parameter to specify the email address at which you would like to receive replies from your email recipients.
  • Subject - Use this parameter to specify the text you would like to appear in the email's subject field.
  • Preheader - Use this parameter to specify the text you would like to appear in the email's preheader area, i.e., the area after the subject line.
  • Email Body - Use this parameter to define the content of your email body. You can do that in two possible ways:

    • Either build your email content using HTML and pass it as the parameter value using Base 64 encoding
    • Or, design your email using the MainBrainer Email Creator. Every email created on MainBrainer is assigned a unique Email Campaign ID. Pass the Email Campaign ID of the email that you want to send as the parameter value.
  • Recipient - Use this parameter to specify the email address at which you want to send the email. In case you wish to send the email to multiple addresses, pass the email addresses of the intended recipients as an array.
  • ListId – In case you wish to send the email to contacts of a particular CRM list, specify the list ID of the desired list using the parameter listId. In case you wish to send the email to multiple contact lists, you can pass multiple List IDs as an array.

    Note

    When you send emails to your CRM contacts, emails will only be delivered to the contacts if their Contact Property – emailOptIn has the value 'true'. Get More details about our CRM and the opt-in procedures

  • Webhook - Use this parameter to specify the webhook URL where you want to receive delivery status updates for the email being sent. When the destination email client returns a delivery status, the status is instantly posted to this webhook URL. Using a Webhook enables your application to receive delivery updates as they happen, in an easily parsable JSON format.
    Updates will be sent for the following delivery statuses:

    • Processed
    • Dropped
    • Deferred
    • Bounce
    • Delivered
    • Open
    • Click
    • Spam Report
    • Unsubscribe

    Alternatively, you can use the Get Email Delivery Status endpoint to retrieve the email delivery status (as explained in the next step).

Note

Note: It is mandatory to specify one of the two - either the parameter 'List ID' or 'Recipients'.

Note

If you wish to send multiple emails at once, MainBrainer will queue them for delivery. Also, standard limits governing the number of emails that can be sent per minute will apply depending on your MainBrainer account type.

Step 4: Monitor the delivery status of your Emails

In case you wish to retrieve the delivery status of the sent emails, pass the response ID value received in the Step 3 above as an input parameter here - Get Email Delivery Status endpoint. This endpoint will return the latest delivery status for the emails.

+ Processed
+ Dropped
+ Deferred
+ Bounce
+ Delivered
+ Open
+ Click
+ Spam Report
+ Unsubscribe

Here is a sample GET request sent by MainBrainer to retrieve the latest delivery status for an Email:

Copy
Copied
{
  "Id": "65564096-7ae8-eb11-84b6-af932d533f34",
  "Status": 100,
  "StatusText": "Sent Successfully",
  "StatusFailedReason": "",
  "Details": [{"Total":1,"Queued":0,"Submitted":1,"Delivered":0,"Bounced":0}]
}

Limits

A maximum of 1000 emails can be sent per request.