POST - To Send an Email with Attachments
Purpose
The API is used to Send an Email with attachments. The attachments should be uploaded to the File Store using the 'Upload Attachments' API. The response values, storeName, attachmentName and attachmentPath from that API should be used in the Request Body of this API.
Request URL
https://mail.zoho.com/api/accounts/<accountId>/messages
Note: You can use the API here to retrieve the accountid for the currently authenticated user.
Request Parameters
Parameter | Data Type | Description |
accountID* | Long | accountID - The unique Zoho Account number associated with the particular account. |
* - Mandatory parameters
Request Body (JSON Object)
Parameter | Data Type | Allowed Values | Description |
fromAddress* | String | Valid from email address corresponding to the account | The from Address that should be used in this email. |
toAddress* | String | Valid recipient email address for the To field | Recipient email addresses for the To field |
ccAddress | String | Valid recipient email address for the Cc field | Recipient email addresses for the Cc field |
bccAddress | String | Valid recipient email address for the Bcc field | Recipient email addresses for the Bcc field |
subject | String | Subject of the email that should be sent | Subject of the email that should be sent |
encoding | String | Default value is UTF-8. Other allowed encoding values are listed below
| The encoding which should be used in the email content. |
mailFormat | String |
| Whether the email should be sent in HTML format or in plain text. The default value is HTML |
attachments | JSON Array | JSON Object of attachments | |
attachmentName | String | Name of the attachment | The value should be got from the upload Attachments API response |
attachmentPath | String | Path in which the attachment is stored | The value should be got from the upload Attachments API response |
storeName | String | Name of the Store where the attachment is saved | The value should be got from the upload Attachments API response |
* - Mandatory parameters
Response Codes
Please refer Response Codes.
Sample Request
For Single attachment:
Copied{
"fromAddress": "my@mydomain.com",
"toAddress": "family@mydomain.com",
"ccAddress": "colleagues@mywork.com",
"bccAddress": "restadmin1@restapi.com",
"subject": "abc",
"content": "Email can never be dead. The most neutral and effective way, that can be used for one to many and two way communication.",
"attachments": [
{
"storeName": "NN2:-167775813820412438",
"attachmentPath": "/1425407266885_ourholidays",
"attachmentName": "ourholidays.jpg"
}
]
}
For Multiple attachments:
Copied{
"fromAddress": "my@mydomain.com",
"toAddress": "family@mydomain.com",
"ccAddress": "colleagues@mywork.com",
"bccAddress": "restadmin1@restapi.com",
"subject": "abc",
"content": "Email can never be dead. The most neutral and effective way, that can be used for one to many and two way communication.",
"attachments": [
{
"storeName": "NN2:-167775813820412438",
"attachmentPath": "/1425407266885_ourholidays",
"attachmentName": "ourholidays.jpg"
},
{
"storeName": "NN2:-1677758138204234566",
"attachmentPath": "/1425407266885_ourvacation",
"attachmentName": "ourvacation.jpg"
}
]
}