Set Tag in Zoho Mail
Table of Contents
Overview
The zoho.mail.setTag task is used to set tags to the specified email in Zoho Mail.
Syntax
<response> = zoho.mail.setTag(<message_id>, <tag>, <connection>);
where:
Params | Data type | Description |
<response> | KEY-VALUE | The response that represents the status of the executed task. |
<message_id> | NUMBER | The ID of the email to which the tag will be set. |
<tag> | NUMBER/ LIST/ TEXT | The ID or the name of the tag that will be set to the specified email. Note:
|
<connection> | TEXT | The link name of the connection. Note:
|
Example 1: Set tag to an email using tag ID
The following example sets the tag with ID - 6729326000000548039 to the email with ID - 6729326000001836629 in Zoho Mail:
response = zoho.mail.setTag(6729326000001836629, 6729326000000548039, "mail_oauth_connection");
where:
response
6729326000001836629
6729326000000548039
"mail_oauth_connection"
Example 2: Set tag to an email using tag name
The following example sets the tag - blog to the email with ID - 6729326000001836629 in Zoho Mail:
response = zoho.mail.setTag(6729326000001836629, "blog", "mail_oauth_connection");
where:
"blog"
Example 3: Set multiple tags to an email
The following example sets the tags specified in - tag_ids to the email with ID - 6729326000001836629 in Zoho Mail:
// Create a list variable to hold the IDs of the tags that will be set to the specified email tag_ids = List(); tag_ids.add(266980000000005034); tag_ids.add(266980000000005036); tag_ids.add(266980000000014001); // Execute the set tag task response = zoho.mail.setTag(6729326000001836629, tag_ids, "mail_oauth_connection");
where:
tag_ids
Response
Success Response
- The success response will be returned in the following format:
{
"message":"Action markLabels is successful",
"status":"success"
}
Failure Response
- The failure response will be returned in the following format:
{
"message":"Error while processing the request! The label with label-id(s) [6729326000000008027] are not available",
"status":"failure"
}