The Sendmail task can be used to send emails from your Zoho Creator application. For example, you can invoke the sendmail function from Form Actions -> on add -> on success script to send mail when a new record is successfully added to the database. To avoid spam email messages, if the From: address is not a zoho.adminuserid or zoho.loginuserid, the To: address can only be zoho.adminuserid and the sendmail task cannot have any CC: or BCC: address.
You can also directly specify the address in the To: field within quotes, for example "email@example.com", if the to address remains the same for all the records. To send mail to the email ids specified in each record, use the input.<field_name_of_type_email>, which will replace the value of the email id in each record. The subject and message fields can be customized to suit the user requirements. Again, the input.<field_name> can be used to substitute the value of the record.
From : <string expression>
To : <string expression>
Subject : <string expression>
Message : <string expression>
You can configure to send e-mail message with form data either from the Form GUI or by adding Deluge Script with the Send mail task.
Steps to add the Send mail script using Script Builder:
On clicking the Edit button in the script, the Send Mail screen is displayed.
Now, when a record is submitted, the configured email is sent to the specified To address with the Form data. A sample format of the email is shown below.
You can include the record summary template in your send mail task configured in the Form Actions -> On Success block . If Include Template check-box is selected, the record templates created for the form will be displayed as a list below this option. You can select the required template and choose to send it as an inline content or as PDF attactments. If you have not created any custom record templates, use the Default Template that displays the form data in a simple table format.
The CEO of a company wants to address all the new employees who have joined after certain date say, '10-jun-2007' . We have to mail all these new employees. Lets see how we can achive this.
for each x in Employee [JoinDate >'10-Jul-2007']
To : x.EmailID
From : zoho.adminuserid
Subject : "Meeting at 6:pm tomorrow"
Message : "As our CEO wants to address the new employees, you are requested to attend the meeting.
To send a link/url in your e-mail message, the actual link must be specified within the <a href> html tag and within single quotes, as shown in the sample below. The code is added to On Add -> On Success section.
"<a href=' http://www.company.com/files/att1.pdf '>PDF1</a>" + "<a href=' http://www.company.com/files/att2.pdf '>PDF2</a>")
We have an uninstall form with options "Dont Need it", "Not satisfied with the service" and "Temporary Uninstall" added as decision fields. Before uninstalling the app, a customer needs to fill in this form with his selected options.
Screenshot displaying the uninstall form with selected options
Upon submitting the form, a mail is generated to the app owner with the options he has chosen.
Screenshot displaying the mail content
This can be achieved by adding the following code in the On Add -> On Success section of the form:
//declare and iterate a variable to store the selected options
tempstr = "";
if(input.Dont_need_it == true)
tempstr = tempstr + "<br />Dont Need it";
if(input.Not_satisfied_with_the_service == true)
tempstr = tempstr + "<br />Not satisfied with the service";
if(input.Temporary_Uninstall == true)
tempstr = tempstr + "<br />Temporary Uninstall";
//add send mail task to send a mail with selected options
To : zoho.adminuserid
From : zoho.loginuserid
Subject : "Test"
Message : "<p>My reasons for uninstalling the app are:</p>"+ tempstr