Email Sending API

Purpose

The API is used to send transactional emails.

Request URL

https://api.zeptomail.com/v1.1/email

Authorization token

You need to add send mail token to authenticate your API requests. This is a unique token that you can generate within your Mail Agent in your ZeptoMail account. Use the send mail token as a header when you call ZeptoMail REST Email Sending API.

Example

POST /v1.1/email

Query String:

Method: POST
HOST: https://api.zeptomail.com/v1.1/email
Header:
Authorization: zoho-enczapikey <space> <send mail token>

Steps to generate Send mail token:

  1. Navigate to the Mail Agents tab on the left panel of your ZeptoMail account and select a Mail Agent that you want to connect to your application.
  2. On the top right section, click on Setup Info (gear icon). This will open the Setup Details page.
  3. From here you can copy your Mail Agent specific send mail token under the API tab.
  4. You can use the default Send Mail Token or generate a new one.

Mail Agents >> SMTP & API Info >> Send Mail Token >> Click to copy icon

Request Body

* - Mandatory parameters

ParameterData TypeDescription
bounce_addressString

The email address to which bounced emails will be sent.

Allowed value - A valid bounce email address as configured in your Mail Agent.

from*JSON object

Allowed value - A valid sender email address with "address" and "name" key-value pairs.

          addressString

A valid email address containing a domain that is verified in your Mail Agent.

          nameString

Sender's name.

to*JSON arrayAllowed value - JSON object of email_address.
         email_addressJSON object

A valid recipient email address with "address" and "name" key-value pairs.

          addressString

Recipient's email address field.

          nameString

Recipient's name.

reply_toJSON array

Allowed value - JSON object of reply_to email addresses.

          addressString

The email address to which the recipient's email responses will be addressed.

Allowed value - A valid email address containing a domain that is verified in your Mail Agent.

          nameString

Name for the reply-to parameter.

subject*String

The subject of the email to be sent.

textbody / htmlbodyString

This is the body content for your email.

Allowed value

Your email body can either be a textbody or a htmlbody.

ccJSON array

Email addresses of cc'd recipients.

Allowed value - JSON object of email_address.

bccJSON array

Email addresses of bcc'd recipients.

Allowed value - JSON object of email_address.

track_clicksBoolean

You can enable or disable email click tracking here.

You can also enable email click tracking in your Mail Agent under Email Tracking section.

Note: The API setting will override the Mail Agent settings in your ZeptoMail account. 

Allowed value 

True - Enable email click tracking.

False - Disable email click tracking.

track_opensBoolean

You can enable or disable email open tracking. 

You can also enable email open tracking in your Mail Agent under Email Tracking section.

Note: The API setting will override the Mail Agent settings in your ZeptoMail account. 

Allowed value 

True - Enable email open tracking.

False - Disable email open tracking.

client_referenceString

An identifier set by the user to track a particular transaction.

mime_headersJSON object

The additional headers to be sent in the email for your reference purposes.

attachmentsJSON array

The attachments you want to add to your transactional emails. Click here to view the list of unsupported formats. 

Allowed value - JSON object of attachments. 

 It can either be a base64 encoded content or file_cache_key or both.

          contentString

The content of your attachment.

Allowed value - Base64 encoded value of a file.

          mime_typeString

Indicates the content type in your attachment. 

Allowed value 

 simple text message - plain / text  

image file - image / jpg

          name 

The file name of your attachment.

          file_cache_keyString

The unique key for your attached files in a Mail Agent.

Obtain file_cache_key from the File Cache section in your Mail Agent.

nameString

The file name of your attachment as in the File Cache section in your Mail Agent.

Obtain file name from the File Cache section in your Mail Agent. 

inline_imagesJSON array

This is the Inline image added to your email. 

Allowed value
It can either be a base64 encoded content or a file_cache_key or both. 

The base64 content contains mime_type, content and cid parameters.

          cidString

the content id used by html body for content lookup. Each content should be given a separate cid value. 

Allowed value

It can either a base64 encoded content or a file_cache_key or both.

Success Response Parameters 

ParameterData TypeDescription
dataJSON arrayIt consists of code, additional_info and message parameters
codeStringThe code corresponding to a success response
additional_infoJSON arrayProvides additional information about the action performed in the request
messageStringThe action taken for this request
messageStringThe status of the request made
request_idStringA unique id which is generated for every request
objectEmailIt signifies that the response is for email API

Failure Response Parameters

ParameterData TypeDescription
errorJSON objectIt consists of code, details, message, and request_id parameters
codeStringThe code corresponding to the status of the request made
detailsJSON arrayIt consists of code, message and target parameters
codeStringThe code for the error found
messageStringReason for the error
targetStringThe field that caused the error
messageStringThe status of the request made
request_idStringA unique id which is generated for every request

HTTP status codes

Status code

Description
2xxSuccess
4xx

Failure.

Action needed at the user end to fix the error.

5xx

Failure.

Action needed at ZeptoMail server to fix the error.

Error Codes

Note:

Before you get started it is important to know that ZeptoMail is for sending transactional emails like welcome emailers, password resets emails, OTPs. We do not support sending of bulk emails or promotional emails like newsletters or marketing campaign emails. If you are looking for a bulk email provider, you can visit Zoho Campaigns.

Curl Request details

Copiedcurl "https://api.zeptomail.com/v1.1/email" \
-X POST \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization:Zoho-enczapikey ***" \
-d '{
	"bounce_address":"bounces@info.zylker.com",
	"from": { "address": "accounts@info.zylker.com",  "name": "Paula"},
	"to": [{"email_address": {"address": "rudra.d@zylker.com","name": "Rudra"}}],
	"subject":"Account Confirmation",
	"htmlbody":"<div><b> Kindly click on Verify Account to confirm your account </b></div>"
}'