Customizing Email Messages

Some of the frequently asked questions on customization of the e-mail message in the sendmail function,  are listed below:

  1. How can I insert line breaks to my e-mail message
  2. How can I send e-mail message with form data?
  3. How can I send only specific field values in the e-mail message
  4. How can I send a URL/link in my e-mail message
  5. How can I send the URL  of the uploaded file, in my e-mail message
  6. Can I send e-mail from Form A with url to populate a field value in Form B?
  7. How can I send the url to view the current record
  8. How can I send mail with all the values selected in the multi-list field of my form? 
  9. How can I send attachments to my e-mail

 

How can I insert line breaks to my e-mail message

A message could be sent as "Plain Text" or "HTML".  Use <br> tag if the content is HTML and \n if the content type is "plain text".  For example,

   on  add
{
on success
{
sendmail
(
To : zoho.loginuserid
From : zoho.adminuserid
Subject : "To insert line breaks"
Message : "Dear Customer, "+ "<br>Your order has been processed" ) } }

How can I send e-mail message with form data?

To send e-mail message with form data, use the input.formdata variable in On Add -> On Success or On Edit -> On Success script. A sample code for the same is given below:

   on  add
{
on success
{
sendmail
(
To : zoho.loginuserid
From : zoho.adminuserid
Subject : "Order Confirmation"
Message : "Dear Customer <br>, We have received your order request with the following details <br>"
+ input.formdata
)
}
}

User submitted data

Order Number : Inv. 4
Order Date: 10-03-2008
Product: Photo 5 - Medium
Quantity: 4
Due from Customer : 20.0 

Refer FAQ - Form Builder, to configure the above from the GUI.

How can I send only specific field values in the e-mail message

To send only specific field values in your e-mail, use the input.<field_name> variable in On Add -> On Success script. For example, you have 3 fields (Name, Age, Email), and in the email message you want to send only the Name and E-mail field values. The format for the same will be,

   on  add
{
on success
{
sendmail
(
To : zoho.loginuserid
From : zoho.adminuserid
Subject : "Order Confirmation"
Message : "Name : "+input.Name+"<br>" +"Email : "+input.Email
)
}
}

Refer FAQ - Form Builder, to configure the above from the GUI.

How can I send a URL in my e-mail message

To send a link/url in your e-mail message, the actual link must be specified within the <a href> html tag and the actual link must be within single quotes, as shown in the sample below:

   on  add
{
on success
{
sendmail
(
To : zoho.loginuserid
From : zoho.adminuserid
Subject : "sending links in e-mail messages"
Message : "Please refer the following links : "+"<a href=' http://www.company.com/files/att1.pdf '>PDF1</a>" +
" <a href=' http://www.company.com/files/att2.pdf '>
PDF2</a>"
)
}
}

How can I send the url  of the uploaded file, in my e-mail message

Get the url/link of the uploaded file by specifying the url within the <a href> tag, in the following format.  For example, in the sample message given below, File_Upload_1 is the name of the file upload field and the actual link is specified within single quotes.

   on  add
{
on success
{
sendmail
(
To : zoho.loginuserid
From : zoho.adminuserid
Subject : "sending uploaded file links in email messages"
Message : "<a href='http://creator.zoho.com/DownloadFile.do?filepath=/" + input.File_Upload_1
+ "&sharedBy=" + zoho.adminuser + "'>Uploaded File</a>"
)
}
}


Can I send e-mail from Form A with url to populate a field value in Form B?

To populate a field value in Form B by sending e-mail, you have to pass the field value with the form url. For example, assume you have a e-mail field named clientEmail in your current form, and you want to send mail to this e-mail with the url of Form B and populated in with the To address of your e-mail.  To do this, you have to specify the form url with the field name and the value to be populated, within the <a href> tag, as given below:

   on  add
{
on success
{
sendmail
(
To : input.clientEmail
From : zoho.adminuserid
Subject : "sending uploaded file links in email messages"
Message : "Enter your order details in" + "<a href='http://creator.zoho.com/sampleapps/form/355/Email_1=" + input.clientEmail
+ "'>" + " Form B</a>"
) } }

In the above message,

- http://creator.zoho.com/sampleapps/form/355/ is the link to the form, with owner name sampleapps and 355 as the formnumber.
- Email_1 is the name of the e-mail field in the form.
- clientEmail is the name of the e-mail field in the current form, from where the e-mail is sent on form submission.

Selecting the link in the email message will display Form B with the Email_1 field updated with the input.clientEmail value.

 

How can I send the url to view the current record

The current record can be fetched by specifying the view link within the <a href> tag, as shown in the format given below. The input.ID will display the current record in the view.

   on  add
{
on success
{
sendmail
(
To : input.clientEmail
From : zoho.adminuserid
Subject : "sending uploaded file links in email messages"
Message : "<a href='http://creator.zoho.com/<your user id>/view/2/record/" + input.ID + "'>View this record </a>" ) } }

How can I send mail with all the values selected in the multi-list field of my form? 

Refer the topic Tips & Tricks -> Iterating Data in Radio buttons/check-boxes.


How can I send attachments to my e-mail

Zoho Creator currently does not support attachment in e-mail messages. As a workaround, you can use our Zoho Viewer to upload your document and send the document link in your e-mail message.

 

Note IconNote: The XSS Security Level in the Application Settings dialog must be set to "Low" to execute the HTML tags. The Application Settings link is displayed in the
top-right corner, in Edit mode