Zoho Creator: Sendmail Syntax

Published by James Hess on

The Zoho Creator sendmail task documentation is lacking. While developing a script to automate the sending of emails in a Zoho Creator app, I was surprised by how much was missing from the official documentation of the sendmail task. I found myself hunting for any example of the sendmail syntax so that I could piece together a functional script. Here what I was able to dig up.

sendmail
         [
             from : "example@email.com"
             to : "example@email.com"
             cc : "example@email.com"
             bcc : "example@email.com"
             reply-to : "example@email.com"
             subject : "Example Subject"
             message : "<b>Example Body</b>"
             content-type : "HTML"
             attachments : file:input.first_attachment_field, file:input.second_attachment_field
         ]
fromrequiredstringNeeds to be a valid email address. Will be displayed as the sender email to recipients.
torequiredstring
list of strings
Can be a single email address or a comma separated list of email addresses.
ccoptionalstring
list of strings
Similar to the To field.
bccoptionalstring
list of strings
Similar to the To field.
reply-tooptionalstring
list of strings
Similar to the To field.
subjectrequiredstringWill be displayed as the subject of email to recipients.
messagerequiredstringWill be displayed as the body of the email to recipients. Can contain HTML markup.
content-typeoptionalstring“HTML” or “Plain Text”. Defaults to “HTML” if not provided. Displays the email to the recipient either with the HTML formatting or in plain text.
attachmentsoptionalfile
list of files
Must be in the format “file: <file_upload_field>”. Can be a single attachment or multiple attachments comma separated.

While you can use variables and concatenation within the sendmail block, you won’t be able to include any conditionals (i.e. If statements) or loops. If this level of logic is required, be sure to generate your strings or lists prior to the sendmail block and save it to a variable, which you can then use inside the block.

I ran into some further frustration when trying to attach a variable number of attachments to the email. See my post titled Zoho Creator Sendmail with Many Attachments for a work around.

If you’ve identified any additional parameters for the sendmail task that aren’t listed, please let me know.

Categories: Zoho