Send mail
Overview
Note: When an email is triggered after a record is added via the add record task, the image and signature fields in the added record will not be included in the attached PDF.
The send mail deluge task when executed sends an email to the specified recipients.
For example, in Zoho Creator:
- You can use this task to send a confirmation email to users when they successfully submit a form.
- You can attach reports to the email, select what records you want to send based on criteria, attach file upload field values, attach record templates, and you can choose the format in which the attachment will be sent.
Syntax
sendmail [ from: <from_address> to: <to_address> cc: <cc> bcc: <bcc> reply to: <reply_to_address> subject: <subject> message: <message> content type: <content_type> attachments: <attachment> ]
Parameter | Data type | Description |
---|---|---|
<from_address> | TEXT | The value you provide here will be displayed as the sender's email address. Allowed Values:
Note: Click here to learn about which the restrictions imposed on this parameter in view of spam control. |
<to_address> | TEXT/ LIST | The email address to which the email will be sent. Allowed Values:
|
<cc_address> (optional) | TEXT/ LIST | Email address of the recipients to whom the email should be copied. Recipients in this list will be able to see all others in this list. Allowed Values:
|
<bcc_address> (optional) | TEXT/ LIST | Email address of the recipients to whom the email should be copied. Recipients in this list will not be able to see others in this list. Allowed Values:
|
<reply_to_address> (optional) | TEXT/ LIST/ comma-separated TEXT | The email address specified here will be populated in the "To" address when the email recipient clicks on "Reply" for the email notification which is editable. The following are the examples of how multiple reply to email addresses can be provided.
replyToAddresses = List(); replyToAddresses.add("shawn@zylker.com"); replyToAddresses.add("hailee@zylker.com"); replyToAddresses.add("brent@zylker.com");
replyToAddresses = "shawn@zylker.com, hailee@zylker.com, brent@zylker.com";
reply to = "shawn@zylker.com", "hailee@zylker.com", "brent@zylker.com" Note: You can provide a maximum of 20 reply to email addresses. |
<subject> | All data types | Subject of the email. |
<message> | All data types | Content of the email. This can be provided as HTML or plain text. |
<content_type> (optional) | TEXT | It could be one of the following:
Default value: HTML Note: By default, if the <message> content contains HTML tags, they will be rendered. To send HTML tags without rendering, mention <content_type> as Plain rexr. |
<attachments> (optional) | FILE | Files that needs to be attached with the mail. Note:
|
To attach Zoho Creator entities
Zoho Creator Entity | Format | Description |
Reports | For Pivot reports: For all other report types: view: <Report_link_name> [<criteria>] as <attachment_format> | Use this parameter to attach a report, containing records which meet a specified criteria, in a specified format.
You can attach multiple reports separated by a comma as shown below: view: <Report_link_name1> [<criteria>] as <attachment_format>, view: <Report_link_name2> [<criteria>] as <attachment_format>, view: <Report_link_name3> [<criteria>] as <attachment_format> .... Note: This entity is not applicable for published forms. |
Files uploaded in file fields | file: input.<file_upload_field> | Use this parameter to attach the values specified in the file upload field types while submitting the form
You can attach multiple file upload field values separated by a comma as shown below: file: input.<file_upload_field1>, file: input.<file_upload_field2>, file: input.<file_upload_field3> ... |
Files fetched using the fetch record task | file: <collection_variable>.<file_upload_field> | Use this parameter to attach file upload field type values held in a collection variable.
You can attach multiple file upload field values in different collection variables separated by a comma as shown below: file: <collection_variable1>.<file_upload_field>, file: <collection_variable2>.<file_upload_field>, file: <collection_variable3>.<file_upload_field> ... |
Record template | Syntax in form workflow: template: <record_template> as <attachment_format> Syntax in custom function: template: <record_template>: <form_link_name> <record_id_variable> as <attachment_format> | Use this parameter to attach record templates in a specified format.
Only templates based on the form specified in the workflow can be sent as an attachment. You can attach multiple templates separated by a comma as shown below: template: <record_template1> as <attachment_format>, template: <record_template2> as <attachment_format>, template: <record_template3> as <attachment_format> .... Use the following syntax to attach multiple templates to a sendMail task written in a custom function template: <record_template1>: <form_link_name1> <record_id_variable1> as <attachment_format>, template: <record_template2>: <form_link_name2><record_id_variable2> as <attachment_format>, template: <record_template3>: <form_link_name3><record_id_variable3> as <attachment_format> .... Note: The <record_id_variable> can be a variable that holds the ID of the record or a fetch records task that extracts the ID of a specific record. You cannot directly supply a NUMBER value representing the required record ID. |
In Zoho Creator, this task can be used in the following events
When a record is Created | ||
On Load | Yes | |
On Validate | Yes | |
On Success | Yes | |
On User input | Yes | |
Subform on add row | Yes | |
Subform on delete row | Yes | |
When a record is Created or Edited | ||
On Load | Yes | |
On Validate | Yes | |
On Success | Yes | |
On User input | Yes | |
Subform on add row | Yes | |
Subform on delete row | Yes | |
When a record is Edited | ||
On Load | Yes | |
On Validate | Yes | |
On Success | Yes | |
On User input | Yes | |
Subform on add row | Yes | |
Subform on delete row | Yes | |
When a record is Deleted | ||
On Validate | Yes | |
On Success | Yes | |
Other workflow events | ||
On a scheduled date | Yes | |
During approval process | Yes | |
During payment process | Yes | |
In a Custom Function | Yes | |
In an Action item in report | Yes |
Send emails from a verified address
Anti-spam measures
In services other than Zoho Cliq and Zoho Mail, the From: address should only be specified as zoho.adminuserid, or zoho.loginuserid*, or a verified email address. Otherwise, the sendmail task will fail.
From To Result zoho.adminuserid, zoho.loginuserid (*only when the logged in user is not a customer portal user), or verified email address
(or)
variable that contains any of theseAny email address Mail will be sent email address other than zoho.adminuserid, zoho.loginuserid, or verified email address Any email address Error while saving variable that contains email address other than zoho.adminuserid, zoho.loginuserid, or verified email address Any email address Error during run time In Zoho Cliq and Zoho Mail, the From: address should only be specified as zoho.loginuserid, or a verified email address. Otherwise, the sendmail task will fail.
From To Result zoho.loginuserid or verified email address
(or)
variable that contains any of theseAny email address Mail will be sent email address other than zoho.loginuserid or verified email address Any email address Error while saving variable that contains email address other than zoho.adminuserid, zoho.loginuserid, or verified email address Any email address Error during run time
Examples
1) The following script is a sample snippet of the send mail task.
[
from: zoho.adminuserid
to: "shawn@zylker.com"
cc: "salesmanager@zoho.com"
reply to: "support@zohocreator.com"
subject: "Welcome to Zoho Creator"
message: "<p>Your registration with Basic Plan is successful. You have selected the following Add-on:</p><ul><li>Customer Portal - 500 users</li></ul>"
]
sendmail [ from :"John <" + zoho.loginuserid + ">" to :"john@zylker.com" cc:"salesmanager@zoho.com" reply to :"support@zohocreator.com" subject :"Team meeting" message :"Let's meet at 5" ]
sendmail [ from :"John <" + zoho.adminuserid + ">" to :"john@zylker.com" cc:"salesmanager@zoho.com" reply to :"support@zohocreator.com" subject :"Team meeting" message :"Let's meet at 5" ]
2) The following script is a sample snippet of the send mail task being used in Zoho Creator. It sends an email from a verified email address. The mail is displayed along with the specified name in the recipient's inbox.
[
from: "Shawn <shawn@zylker.com>"
to: "john@zylker.com"
cc: "salesmanager@zoho.com"
reply to: "support@zohocreator.com"
subject: "Team meeting"
message: "Let's meet at 5"
]
3) The following script sends an email with an attachment fetched using the invokeURL task. The email is sent to the email address in the 'candidate_email' field.
[
url: "https://www.zohowebstatic.com/sites/zweb/images/ogimage/zoho-logo.png"
type: GET
];
sendmail
[
from: zoho.adminuserid
to: candidate_email
subject: "Welcome aboard"
message: "We welcome you aboard. Here's wishing you a great career with us."
Attachments :file: fileResp
]
4) The following script sends an email with a report as an attachment from Zoho Creator. The email is sent to the email address in the 'team_email' field. Only the records which meet the given criteria are included in the report. The report link name is "Leads_Report", and only the records which contain the "Status" field value as "Converted" are included in the sent report.
[
from: zoho.adminuserid
to: input.team_email
subject: "Today's Deals"
message: "Please find the PDF attachment for today's deals"
Attachments :view: Leads_Report [Status=="Converted"] as PDF
]
5) The following script sends an email with the 'File Upload' field value as an attachment from Zoho Creator. The email is sent to the email address in the 'hr_email' field. The 'File Upload' field link name is 'resume'.
[
from: zoho.adminuserid
to: input.hr_email
subject: "New application received"
message: "Please find the resume attached."
Attachments :file: resume
]
6) The following scripts send an email with a record template as an attachment from Zoho Creator. The email is sent to the email address in the 'customer_email' field. The template link name is 'Medical_Invoice' and the form link name is 'invoice_details'.
Script if written in form workflow
[
from: zoho.adminuserid
to: input.customer_email
subject: "Thank you for the payment"
message: "Please find your invoice in the attachment"
Attachments :template: Medical_Invoice as PDF
]
Script if written in custom function
sendmail
[
from: zoho.adminuserid
to: input.customer_email
subject: "Thank you for the payment"
message: "Please find your invoice in the attachment"
Attachments :template: Medical_Invoice: invoice_details record_id as PDF
]
7) The following script sends an email with a report from Zoho Creator and an image fetched using the invoke URL task from Workdrive as attachments. The email is sent to the email address in the 'Customer Email' field. Only the records which meet the given criteria are included in the report. The report link name is "Medical_Equipment_Report", and only the records which contain the "Availability" field value as "In Stock" are included in the sent report.
fileResp = invokeurl [ url :"https://download.zoho.com/v1/workdrive/download/9sv1b827f33bdcab545b583168f9642eabd29" type :GET connection :"Workdrive" ]; sendmail [ from :zoho.adminuserid to : "Customer_Email" subject :"Inventory of Medical Equipments" message :"Dear customer, we have attached the report of our medical equipment inventory and a pamphlet mentioned special offers on bulk orders." Attachments : file: fileResp, view:Medical_Equipment_Report[Availability == "In Stock"] as PDF ]
Note:
- Create an OAuth connection named Workdrive and make sure to select WorkDrive.files.READ and ZohoFiles.files.READ scopes.
- "9sv1b827f33bdcab545b583168f9642eabd29" mentioned in the above script is the resource ID of the image that has been uploaded to the Workdrive. It will not be the same for everyone. Copy and paste the resource ID of your image in its place and execute the script.