On this Page
Snap type: | Write | ||||||||
---|---|---|---|---|---|---|---|---|---|
Description: | This Snap provides the functionality to send email messages to an SMTP server in plain text as well as HTML format. It can also format an HTML table and fill the rows by using data from the input view.
| ||||||||
Prerequisites: | [None] | ||||||||
Support and limitations: | Works in Ultra Pipelines if batching is disabled. Supports TLS version 1.2. | ||||||||
Account: | This Snap uses account references created on the Accounts page of SnapLogic Manager to handle access to this endpoint and requires a valid SMTP account. It is possible to send emails anonymously if your SMTP server allows. In that case, you may leave the Email ID and Password fields empty. You may have to set the Secure connection to 'NONE' if your SMTP server requires. See Email Account for information on setting up this type of account.
| ||||||||
Views: |
| ||||||||
Settings | |||||||||
Label
| Required. The name for the Snap. You can modify this to be more specific, especially if you have more than one of the same Snap in your pipeline. | ||||||||
To
| Required. Email addresses of to-type recipients, its exact format including the address separator may be email-server dependent. It may contain JavaScript expression to be substituted with the data from the input view. Example: Snap@example.com, youto@example.com _customer + " Defects and Stories" where the pipeline has a pipeline parameter of customer Default value: [None]
| ||||||||
CC | Email addresses of cc-type recipients, its exact format including the address separator may be email-server dependent. It may contain JavaScript expression to be substituted with the data from the input view. Example: meto@example.com, someoneelse@example.com Default value: [None]
| ||||||||
Bcc | Email addresses of bcc-type (blind carbon copy) recipients, its exact format including the address separator may be email-server dependent. It may contain JavaScript expression to be substituted with the data from the input view. Example: meto@example.com, someoneelse@example.com
| ||||||||
From | The email address of the sender. If there are multiple senders then separate them with a comma. The exact format of the email address including the address separator is email-server dependent. The format may contain a JavaScript expression that must be substituted with the data from the input. Email systems like Microsoft Office 365 enforce having the From field populated. We highly recommend you to populate this field. Default value: N/A Example: meto@example.com, someoneelse@example.com
| ||||||||
Subject | Subject of email message. | ||||||||
Email type | Required. Email type of "Plain text" or "HTML text" or "HTML table". If the Email type property is "Plain text" or "HTML text", the Snap sends one email message per each Document. If the Email type property is "HTML table", each Document provides one row of information for the HTML table. Example: HTML table | ||||||||
Template | Template of email message body. For the email type of "HTML text" and "HTML table", the Template body should be in HTML format. For "HTML table" type, the Snap expects to find <table> and </table> tags inside the Template body. One Document at the input view corresponds to one row of the HTML table. For each Document, the Snap gets a map data referenced by the Table-data path property and insert a row into the HTML table of the message body. The Table-data path property can also reference an array of map data. The Snap uses the key sets of the map data to compose the column headers of the table. The Snap processes the entire stream of Documents in a batch to generate the superset of keys. See Expression Language for items to use with the expression toggle (=), but set Email type to Plain Text. Example: The following is an example for a "HTML table" type of the Template body. It uses Cascading Style Sheets (CSS) for the table style. Please note Gmail does not support CSS in rendering HTML table. You should use in-line style of the HTML table for proper rendering in Gmail. The Snap does not support the in-line style HTML table for individual cells in the table header and rows:
Default value: [None] | ||||||||
Attachments | URLs of files that you want to attach to your email. If the URL protocol is missing, or if a given path is relative, SnapLogic automatically modifies the URL to start with "sldb:///". The Snap supports SLDB, SFTP, and SMB file protocols. The username should be included in the URL as in the example below and the password should be entered into the Attachment password property in the email account. The filename part of the URL can contain wildcards so that multiple files can be attached for each row of Attachments property. It may also contain JavaScript expressions, which can be substituted with the data from the input view.
Example:
Default value: [None]
| ||||||||
Table-data path | JSON path to the map data which corresponds to a row in the HTML table. If it references an array of map data, such as Example: $.table When using just "$" in the Table-data path, the Snap creates an HTML table, wherein the Template Body has the HTML table tags (
| ||||||||
Batch size | The Batch size property is used only for the "HTML table" Email type. The unit of the value is in the number of rows of the HTML table. If the number of Documents the Snap receives from the input view reaches the given Batch size, the Snap composes an email message with an HTML table and sends it to the server. Multiple emails are generate if needed to send out all Documents. The Snap sends the last message at the end of the pipeline execution if any number of the un-sent table rows remain. | ||||||||
Pass through | Determines if input data should be passed through or not. If selected, input data will be mapped as a value to the 'original' key in the output document. Default value: Not selected | ||||||||
Retries | Number of retries when the Snap fails to send email. Initially the Snap waits two seconds before retry, and in every subsequent retry. the delay is doubled up to an hour. Example: 0 (no retry) | ||||||||
This note applies to the case your account is a Gmail account, but it may also apply to other web-based email accounts. Gmail SMTP accounts may not work with the Email Sender Snap. Gmail processes an email hijack detection based on IP addresses and locations. If it sees the IP address that the IMAP/POP3 client app is running from is different than the usual locations, it suspects the account is being hijacked and sends error messages like:
You may find an email from Gmail in the inbox titled "Suspicious sign in prevented", which is caused by the execution of Email Reader Snap. You may be able to see more messages from Gmail in your Gmail account web page: Account > Security > Recent Activity > View activity. |
<!DOCTYPE html> <html> <head> <title>Email Snap HTML Table</title> <style type="text/css"> table.Snap {background-color:transparent;border-collapse:collapse;width:100%;} table.Snap th, table.Snap td {text-align:center;border:1px solid black;padding:5px;} table.Snap th {background-color:AntiqueWhite;} </style> </head> <body> <p>Dear SnapLogic Users:</p> <p>This is a sample Snap email with HTML Table email type.</p> <table class="Snap"> </table> <p></p> <p>Regards,</p> <p>SnapLogic Staff</p> </body> </html> |
Email Attachment from an SFTP LocationIn the below example, the Email Sender Snap mail with an attachment from the SFTP location. Note that in order to read the file attachment from the SFTP location, the Attachment password must be set on the Account Settings of the Snap, else will display an error. The successful execution of the pipeline displays the below output preview: |
Email Attachment from an SLDB LocationIn the below pipeline, the Email Sender Snap reads and sends the mail with an attachment (Customer Information.csv) from an SLDB location.
|