Create a Draft
Purpose
This API is used to create a new draft in an account.
OAuth Scope
Use the scope
MailApps.messages.ALL (or) MailApps.messages.CREATE
ALL - Full access to the messages.
CREATE - Create a new draft.
To generate Authtoken, refer here.
Request URL
Method: POST
https://mail360.zoho.com/api/accounts/{account_key}/drafts
Path Parameters
- account_key* string
- This key is used to identify the account in which the draft has to be created. It is generated during account addition.
- This parameter can be fetched using the Get All Accounts API.
Request Body (JSON object)
- fromAddress* string
- This is the sender's email address.
- toAddress string
- This is the recipient's email address.
- ccAddress string
- This is the recipient's email address to which a Cc of the mail has to be sent.
- bccAddress string
- This is the recipient's email address to which a Bcc of the mail has to be sent.
- labelId JSON Array of long
- This is the ID associated with the label.
- This parameter can be fetched using the Get All Labels API.
- replyTo string
- This is the email address to which reply mail is sent.
- askReceipt string
- Depending on whether the sender requests a Read receipt from the recipient, the value can be
- yes
- no
- Depending on whether the sender requests a Read receipt from the recipient, the value can be
- priority string
- Depending on the priority of the draft, the values can be
- high
- medium
- low
- Depending on the priority of the draft, the values can be
- encoding string
- This is the encoding type that should be used in the email content. The value can be
- Big5 | EUC-JP | EUC-KR | GB2312 | ISO-2022-JP | ISO-8859-1 | KOI8-R | Shift_JIS | US-ASCII | UTF-8 | WINDOWS-1251 | WINDOWS-1250 | big5 |euc-jp | utf-8 | euc-kr | gb2312 | iso-2022-jp | iso-8859-1 | koi8-r | shift-jis | us-ascii | windows-1251 | windows-1250 | X-WINDOWS-ISO2022JP
- The default value is UTF-8.
- This is the encoding type that should be used in the email content. The value can be
- subject string
- Provide the subject of the email.
- mailFormat string
- This is the format in which the mail needs to be sent. The value can be
- html
- plaintext
- The default value is html.
- This is the format in which the mail needs to be sent. The value can be
- includeSignature boolean
- Depending on whether the sender wants to include a signature in the draft, the value can be
- true - to include the signature in the draft.
- false - not to include the signature in the draft.
- Depending on whether the sender wants to include a signature in the draft, the value can be
- 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.
* - Mandatory parameter
Sample Request
Copiedcurl "https://mail360.zoho.com/api/accounts/x7k0**M05r/drafts" \
-X POST \
-H "Content-Type: application/json" \
-H "Authorization: Zoho-oauthtoken ***" \
-d '{
"toAddress" : "rebecca.test@zylker.com",
"ccAddress" : "rebecca.travel@zylker.com,paula@zylker.com",
"bccAddress" : "rebecca.trip@zylker.com,david@zylker.com",
"fromAddress" : "<Rebecca>rebecca@zylker.com",
"subject" : "new Mail testing"
}'
Sample Success Response
Copied{
"status": {
"code": 200,
"description": "success"
},
"data": {
"draftId": "1674571936262110001"
}
}
Sample Failure Response
Copied{
"status": {
"code": 500,
"description": "Internal Error"
},
"data": {
"moreInfo": "Internal Error"
}
}