Send Bulk Email
POST /Email/Batch/
This endpoint is used to send an email to multiple recipients in one go. The emails can be sent immediately or can be scheduled for delivery at a later date and time.
Usage scenario for this endpoint:
This endpoint is especially useful for sending out email marketing campaigns like promotions for upcoming sales, special discount coupons, or event promotions, etc., to your contact lists.
Method | Details |
---|---|
HTTP Method | POST |
Content type | Application/json |
Requires authentication? | YES |
Rate limited? | YES |
Headers | User-Agent |
Module |
End Point
https://apiemail.mainbrainer.com/email/batch
Note:
The batch size should not exceed 1000 Emails per request.
Required Parameters | Usage | Description |
---|---|---|
Access Token or API Key | Authorization: Bearer {token} header | Pass the API key in the request header for request authentication. Read more about our authentication process. |
Recipient | Included email "[email protected]" | In case you would like to send the email to multiple recipients and wish to specify the recipients manually, use the parameter recipients to pass the email addresses of the intended recipients as an array. |
ListId | listId (uuid) eg: "3fa85f64-5717-4562-b3fc-2c963f66afa6 | In case you wish to send the email to contacts of a particular CRM list, pass the list ID of the desired list as the parameter value. In case you wish to send the email to multiple contact lists, you can pass multiple List IDs as an array. |
Sender Name | From Email Name | This parameter specifies the name that you want to display as the sender name for the email. This name helps the email recipients identify who sent them the email. |
Sender From | From Email address Example. [email protected] |
This parameter specifies the email address you want to display as the sender address for the email and the name that you want to display as the sender name for the email. These details helps the email recipients identify who sent them the email. Note: By default, you can only use [email protected] as the sender email for your emails. In case you wish to use your domain address as the sender email, please write to us at [email protected]. |
Reply to email | reply-to emails | This parameter specifies the email address at which you would like to receive replies from your email recipients, and the display name that you wish to use for the address. |
Subject | Use Nice and catchy Subject lines (you can also use Personalization in your subject lines) | This parameter specifies the text that you would like to appear in the email's subject field. |
Preheader | Preheader can be Dynamic using Personalization tags | This parameter specifies the text you would like to appear in the email's preheader area, i.e., the area after the subject line. |
Email Campaign ID | Use Email Template ID of your MainBrainer Account | If you are using the MainBrainer Email Creator to design your email, pass the Email Campaign ID of the email you want to send as the parameter value. Email Campaign ID is the unique identifier for an email campaign created in your MainBrainer account. |
HTML Body | Use your own HTML | If you are designing your email in HTML, encode it into Base64 format and pass it as the parameter value. |
Webhook URL | Delivery Status | 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 |
Note:
To identify the recipients for the email sending, it is mandatory to specify either the parameter - List ID or the parameter - recipients.
Note:
Emails will only be sent to contacts if their emailOptIn
status is true.
Note:
A maximum of 1000 emails can be sent per request.
Optional Parameters | Usage | Description |
---|---|---|
Personalization Substitution Tags | personalizationSubstitutionTags : { "tagName": "[name]", "tagValue": "Sink" } | These tags help you insert dynamic data at the time of email sending. In order to substitute the data at the time of the sending, follow the pattern "substitution_tag":"value” to substitute for the key/value pairs. -- In case you use the parameter 'recipients' to identify the email recipients, the substitutions will work as specified. -- In case you use the parameter 'recipients' to identify the email recipients, the substitutions will work as specified. -- In case you use both the parameters listID and recipients to identify the email recipients, and the information passed under recipients is not in conformity with the information stored in the CRM list, data will get substituted on the basis of information passed under the parameter recipients. -- In case you use the parameter ListID to identify multiple Lists, and a contact exists in both the lists with different information, data will get substituted from either of the lists on a random basis. |
ScheduledDate-time | RFC3339 format (Y-m-d\TH:i:sP) | Pass the scheduled date and time of the email distribution in RFC3339 format (Y-m-d\TH:i:sP). The date and time passed in this parameter will be converted as per the offset value specified in your account settings. |
This example demonstrates how to send an email batch with with manually added recipents :
post url: https://apiemail.mainbrainer.com/email/batch
{
"sendingDetails": {
"listId": [
"3fa85f64-5717-4562-b3fc-2c963f66afa6"
],
"senderFrom": {
"email": "[email protected]",
"displayName": "MainBrainer"
},
"replyTo": {
"email": "[email protected]",
"displayName": "MainBrainer"
},
"subject": "hi [name] Weekend Discount Sale upoto 40% Off",
"preHeaderText": "Grab 40% Discount only for next 2 hours ",
"emailBody": "Your email HTML encoded in base64 format",
"scheduleDateTime": "2021-10-24T14:15:22Z",
"emailCampaignId": "00000000-0000-0000-0000-000000000000",
"webHookUrl": "https://webhook-url.yourdomain.com"
},
"recipients": [
{
"to": "[email protected]",
"personalizationSubstitutionTags": [
{
"tagName": "[name]",
"tagValue": "Sink"
}
]},
{
"to": "[email protected]",
"personalizationSubstitutionTags": [
{
"tagName": "[name]",
"tagValue": "Sink1"
}
]
}
]
}
Returns a 202 Accepted response with content on success.
Response Body
{
"status": true,
"message": "Batch request accepted",
"data": {
"BatchId": "c7e24370-2e51-4294-8010-ace5881efca3"
"QueuedTimestamp": 1630481768446
}
}