Send an Email

Purpose

This API is used to send an email.

OAuth Scope

Use the scope

MailApps.messages.ALL (or) MailApps.messages.CREATE

ALL - Full access to the messages.

CREATE - Create a new email.

To generate Authtoken, refer here.

Request URL

Method: POST

https://mail360.zoho.com/api/accounts/{account_key}/messages

Path Parameters

  • account_key* string
    • This key is used to identify the account from which the email is sent. It is generated during account addition.
    • This parameter can be retrieved using the Get All Accounts API.

Request Body (JSON object)

  • fromAddress* string
    • Provide the sender's email address.
  • toAddress* string
    • Provide the recipient's email address.
  • ccAddress string
    • Provide the recipient's email address for the Cc field.
  • bccAddress string
    • Provide the recipient's email address for the Bcc field.
  • subject string
    • Provide the subject of the email.
  • content string
    • Provide the content of the email.
  • mailFormat string
    • Specify the format in which the mail needs to be sent. The value can be
      • html
      • plaintext
    • The default value is html.
  • inReplyTo string
    • Specifies the email address to which the recipients should reply.
  • refHeader string
    • Specifies the reference header.
  • attachments Array of JSON objects
    • This parameter is an array consisting of JSON objects.
    • Each object in this array contain a key-value pair formatted as: "fileId" : "sampleID". The key, fileId, is constant across all objects. The value associated with fileId signifies the ID of the file that has been uploaded as an attachment and is of the string data type. This value can be obtained from Upload attachment API.

 

To Schedule an Email:

With this API you can also schedule when to send your email. To schedule an email, follow the same procedure as above along with the upcoming additional parameters.

  • isSchedule boolean
    • Depending on whether the mail has to be scheduled or not, the value can be
      • true - if the email should be scheduled.
      • false - if the email should be sent immediately.          
  • scheduleType int
    • Specifies the type of scheduling.
    • Provide the value as 
      • 6, to choose the custom date and time of your choice.
  • timeZone string
    • Specify the timezone to schedule your email.
    • This parameter is mandatory if scheduleType is set to value 6. For example: GMT 5:30 (India Standard Time - Asia/Calcutta).
  • scheduleTime string
    • Specify the date and time you want to schedule your email. 
    • This parameter is mandatory if scheduleType is set to value 6. Format: MM/DD/YYYY HH:MM:SS. For example: 09/15/2023 14:30:28

 

* - Mandatory parameter

Note:

While the Messages APIs focus on individual messages, the Threads APIs deal with entire conversation threads, each of which contains multiple messages.

Sample Request

Copiedcurl "https://mail360.zoho.com/api/accounts/x7**0s/messages" \
-X POST \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization:Zoho-oauthtoken 8024329**d5ac77" \
-d '{
    "subject": "Hello",
    "content": "Hello from Mail 360",
    "fromAddress": "rebecca@gmail.com",
    "toAddress": "paula@zylker.com",
     "attachments" : [ 
        {
            "fileId" : "745ace**-ent"
        }
    ]
}'

Sample Success Response

Copied{
    "status": {
        "code": 200,
        "description": "success"
    },
    "data": {
        "messageId": "1586437732559010001",
        "fromAddress": "rebecca@zylker.com",
        "toAddress": "paula@zylker.com",
        "subject": "Hello"
    }
}

Sample Failure Response

Copied{
    "status": {
        "code": 500,
        "description": "Internal Error"
    },
    "data": {
        "moreInfo": "Internal Error"
    }
}