You can learn more about sending email, using templates, and using expressions with workflow in the Workflow: Sending Email section.

Configuring Email

You can customize the email you send. Customization makes extensive use of variables. You can customize the following aspects of the email.

Send to: This is a list of email addresses or expressions that yield email addresses. Each value must be entered on a separate line.

  1. You can enter specific email addresses, such as JohnHughes@gmail.com. If you enter an email address that contains special characters such as hyphen or plus, you must enclose the email address in quotes, such as:
    "John-L-Hughes@gmail.com".
  2. You can specify that the email address be taken from a field in the record that is being updated. For example, when a new order is added, you may wish to send email to the customer who created the order. You can do this by entering an expression specifying the field name containing the customer's email address. For example, if there is a field called "CustomerEmail" in the added order record, you can specify:
     [CustomerEmail]
  3. You can specify that the email address be taken from a field in a record that is referenced by the record being added or updated. For example, each of your Order records might contain a reference to a Customer record. Each Customer record might contain the customer's email address. When a new order is added, you can send email to the customer who created the order. You can do this by entering the name of the Order record field that references the customer record, followed by the name of the Customer record field containing the customer's email address. For example, assume the name of the Order record field that references the customer record is CustRef. Assume the name of the Customer record field containing the customer's email address is CustEmail. You can specify the customer's email address by entering the expression:
     [CustRef].[CustEmail]
  4. You can specify that the email addresses be taken from an entire column in another table. For example, you could create a table called PeopleToInform having two columns, Name and EmailAddress. Each time a new order is added, you can send email to all of the people in the PeopleToInform table. Do this by entering the expression:
     PeopleToInform[EmailAddress]
  5. You can specify that the email addresses be taken from selected rows in another table. For example, you could create a table called PeopleToInform having three columns, Name, EmailAddress, and Department. Each time a new order is added, you can send email to all of the people in the PeopleToInform table who are in the "Sales" Department. Do this by entering the expression:
    SELECT(PeopleToInform[EmailAddress], ([Department] = "Sales"), TRUE)

While the app is in test mode (i.e. it has not passed a Deployment Check), any messages sent from workflow actions will only be sent to the app creator.

You can see the "Send to", "CC", and "BCC" values who would have received the email by checking the Audit History. It will contain a warning like the following:

"Warnings": "Warning: The client device is running app version 1.000287, which is the latest version. That version is not deployed so all workflow emails are being sent to the app creator. This email would have gone To 'ann@gmail.com' CC'ed to 'bob@gmail.com' and BCC'ed to 'carol@gmail.com'",

Email Subject:
AppSheet creates a default Subject, if you do not specify one. You can specify the Subject in several ways.

You can specify a constant Subject.

Thanks for Your Order!

You can include variables in the Subject that are replaced by values from the record. 

Thanks <<[CustomerName]>> for Your Order! 

You can include expressions in the Subject.

Thanks <<[CustomerName]>> for Your Order on <<TODAY()>> which Will Arrive on <<TODAY() + 7>>

Email body: You have three options when it comes to the body of the email. 

  1. You can do nothing and receive a Default Email Body.
  2. You can customize the Email Body field.
  3. You can specify an Email Body template.

Default Email Body
Here's what it looks like if you do nothing and receive a default email body. It contains all of the values for the updated row except for Hidden columns and Show type columns.

Email Body
You can specify a Body containing text, images, variables, and expressions directly in the Body attribute. After the variables and expressions are replaced, the result becomes the email body. 

Specifying the Body in this way works if you have a very simple email Body; otherwise, you should use an Email Body Template.

Email Body Template
You can control the contents and format for your email body by using either a Google Doc or Microsoft Word Document as a template file as described here. We recommend using an Email Body Template if you wish to control the format of the email body.

Attachment Template

You can optionally add an attachment to your email by specifying an Attachment Template. The Attachment Template can take many forms including:

  1. PDF Attachment
  2. XML Attachment
  3. JSON Attachment
  4. Text Attachment

PDF attachments are the most popular form of attachment. Other forms of attachment are useful but rare.


PDF Attachment:

You can create a PDF attachment by using a Google Doc or a Microsoft Word template file as described here.

The PDF attachment can be at most 20MB in size.


XML Attachment:

You can create an XML attachment using a .txt template file containing XML.

You can create a template file by creating an empty .txt file on your personal computer, entering XML text like that below, and saving the file to your personal computer.

<?xml version="1.0" encoding="UTF-8"?>
<record>  
   <UpdateMode><<_UPDATEMODE>></UpdateMode>
   <Application><<_APPNAME>></Application>
   <TableName><<_TABLENAME>></TableName>
   <UserName><<_USERNAME>></UserName>
   <LastName><<LastName>></LastName>
   <FirstName><<FirstName>></FirstName>
   <Age><<Age>></Age>
  <Computed Total><<[Qty]*[Price]></Computed Total>
   <ComputedName><<_ComputedName>></ComputedName>
</record> 


Once the template file is saved to you personal computer, upload it to one of the following Data Sources:

  1. Box
  2. Dropbox
  3. Google Drive
  4. Microsoft Office 265
  5. Microsoft OneDrive

For example, you can upload the template file to Google Drive, as follows. 

  1. Open Google Drive and navigate to the Google Drive folder where you wish to upload the file. 
  2. Click the "New" button and then click "File upload". 
  3. When the file open dialog appears, navigate to the template file on your personal computer, select the file, and click "Open". This will upload the template file to Google Drive.

Once the template file is uploaded:

  1. Click the file icon for the AttachmentTemplate field. 
  2. When the "Select a file" dialog appears, navigate to the uploaded template file and select it.
  3. This makes the uploaded template file the current AttachmentTemplate.

Each time you modify and upload the template file to Google Drive, Google Drive will assign it a new DocId. You must click the file icon for the AttachmentTemplate field, as described above, to make the newly uploaded template file the current AttachmentTemplate.


JSON Attachment:

You can create an JSON attachment using a .txt template file containing JSON.

You can create a template file by creating an empty .txt file on your personal computer, entering JSON text like that below, and saving the file to your personal computer.

UpdateMode: <<_UPDATEMODE>>,
   Application: <<_APPNAME>>,
   TableName: <<_TABLENAME>>,
   UserName: <<_USERNAME>>,
   LastName: <<LastName>>,
   FirstName: <<FirstName>>,
   Age: <<Age>>,
   Computed Total: <<[Qty]*[Price]>,
   _ComputedName: <<_ComputedName>>

Once the template file is saved to you personal computer, upload it to one of the following Data Sources:

  1. Box
  2. Dropbox
  3. Google Drive
  4. Microsoft Office 265
  5. Microsoft OneDrive

For example, you can upload the template file to Google Drive, as follows. 

  1. Open Google Drive and navigate to the Google Drive folder where you wish to upload the file. 
  2. Click the "New" button and then click "File upload". 
  3. When the file open dialog appears, navigate to the template file on your personal computer, select the file, and click "Open". This will upload the template file to Google Drive.

Once the template file is uploaded:

  1. Click the file icon for the AttachmentTemplate field. 
  2. When the "Select a file" dialog appears, navigate to the uploaded template file and select it.
  3. This makes the uploaded template file the current AttachmentTemplate.

Each time you modify and upload the template file to Google Drive, Google Drive will assign it a new DocId. You must click the file icon for the AttachmentTemplate field, as described above, to make the newly uploaded template file the current AttachmentTemplate.

Attachment Name: Every email attachment has an Attachment Name. 

If you do not specify an Attachment Name, the following default value is used. 

ChangeReport

You can specify a constant Attachment Name.

My Attachment Name

You can include variables in the Attachment Name that are replaced by values from the record.

My Attachment for <<CustomerName>>

You can include expressions in the Attachment Name.

My Attachment for <<CustomerName>> from <<_APPNAME>> on <<TODAY()>>


Attachment Archive: You can archive the PDF attachment as described here

Attachment Page Orientation: You can specify either "Portrait" or "Landscape". 

Attachment Page Size: You can specify the page size. 

Other Attachments: You can attach Image, Signature, Drawing, Thumbnail, or other Files to your email. This is often used by applications that take photographs and want to attach one or more photos to the workflow email. This can also be used to attach one or more existing PDF, Microsoft Word, or Microsoft Excel files, among others.

Each other attachment file name must be entered on a separate line. You can enter file names or expressions that yield file names. 

We simply attach the documents you specify to the email. We do not replace variables in these attachments like we do for the Attachment template.

You can specify:

  • A file name such as MyPhoto.jpeg or MyWordFile.docx.
  • A simple column expression like [ImageColumn] or [FileColumn] where the file name is stored in the column.
  • A more complex expression, like the de-reference expression [ProductRef].[ProductPhoto]. Here the file name is stored in the [ProductPhoto] column.
  • It is common to store the images for a parent table in a child table. This allows each parent record to have zero, one, or more child images. Each child record contains an image field and a Ref field to the parent record. The parent record contains a Reverse Ref field containing the key values of the child image records. If the Reverse Ref field in the parent record is called "Related Images" and the image field in the child record is called "Image", then you can include the child images as attachments by specifying [Related Images][Images] 

Your application can control which other attachment files to include.

  1. Create an EnumList field containing the names of the attachments you can choose from. I called my EnumList  field "Attachments" and entered  the EnumList values "PDF1", "PDF2", and "PDF3".
  2. In your workflow rule, specify the following expression in the "OtherAttachments" property:
LIST(IF(CONTAINS([Attachments], "PDF1"),"PDF1.pdf","")) + LIST(IF(CONTAINS([Attachments], "PDF2"),"PDF2.pdf","")) + LIST(IF(CONTAINS([Attachments], "PDF3"),"PDF3.pdf",""))


Your other attachment files must reside in the right place for us to find them.

For Google, Microsoft, Dropbox, Box, and other providers that are capable of storing files, we start from the folder containing your worksheet. If you only specify a file name, we look for this file in the folder contains your worksheet. If you specify both folder names and a file name, we start from the folder containing your worksheet and follow the folder path you specify.

Your other attachment files must be secured properly for us to retrieve them. Normally, you must secure your other attachment files so that the app owner can read them. This is necessary because, the app is running under the identity of the app owner.

In the rare case when your app is using a private table, you must secure your other attachment files so that the current app user can read them. This is necessary because, when private tables are used, the app is running under the identity of the app user rather than the app creator. When using private files, we look for the other attachment files relative to the private user's worksheet. As a result, the attachment files from each private file user are unique to that user.

For SQL Server. MySQL, and other providers that are not capable of storing file, we look for other attachment files in the main cloud file system associated with the app creator's primary AppSheet account, be it Google Drive, Dropbox, Office 365, or Box. We start from the folder you specify in the "Default folder path" of the My Account > Settings pane.
 

CC: Email "CC" value. This is a list of email addresses or expressions that yield email addresses as described with Send to. Each value must be entered on a separate line.

BCC: Email "BCC" value. This is a list of email addresses or expressions that yield email addresses as described with Send to. Each value must be entered on a separate line. 

Reply to: Email "Reply to" email address. You may specify:

  • Nothing, in which case the reply to email address is "noreply@appsheet.com" .
  • A specific email addresses, such as JohnHughes@gmail.com. If you enter an email address that contains special characters such as hyphen or plus, you must enclose the email address in quotes, such as "John-L-Hughes@gmail.com".
  • An expression that yields a single email address.

From Display: Email "from display" value. This value is displayed as the source of the email. You can specify:

Nothing, in which case the application owner name is used.

A constant value which is enclosed in quote characters.

From Customer Support at Cascade Fine Fruit 

A template that refer to table columns. 

From <<[FirstName]>> <<[LastName]>> at Cascade Fine Fruit

A template that contains expressions.

From <<CONCATENATE([FirstName], "_", [LastName], "@CascadeFruit.com")>>


From:
Workflow email is always sent from the AppSheet email account  

noreply@appsheet.com

You cannot override this value because the anti-spam policies of email providers do not permit us to send mail and masquerade as different email originators.

If you must customize the From email address, consider sending email via a web based email provider that you invoke via a workflow web hook.

PreHeader: Every email can include a PreHeader. 

If you specify nothing, the following default PreHeader is used.

<<_UPDATEMODE>> to application '<<_APPNAME>>' table '<<_TABLENAME>>' by '<<USEREMAIL()>>' at <<_NOW>> 

This yields a PreHeader such as "Update to application 'Workflow' by 'Julie Morgan' at 8/26/2015 6:12:28 PM". 

If user authentication is not required, the following default PreHeader is used. It omits " by <<USEREMAIL()>>".

<<_UPDATEMODE>> to application '<<_APPNAME>>' table '<<_TABLENAME>>' at <<_NOW>> 

You can specify a constant PreHeader.

Your Order

You can specify a PreHeader containing references from fields in the table.

Order for <<[FirstName]>> <<[Lastname]>>

You can specify a PreHeader containing expressions.

Order for <<[FirstName]>> <<[Lastname]>> on <<TODAY()>>

You can suppress the PreHeader by entering a single empty character.

(A single empty space, and nothing else.)

 

Troubleshooting Email 

See this article.

 

Did this answer your question?