Key Capabilities
- SMTP-based email delivery using a user-specified server or SendGrid, with OAuth 2.0 support for modern providers
- Template mode for dynamic content generation from XML data or Script
- Attachment mode for sending files with customizable message bodies
- Support for multiple recipients (To, CC, and BCC) with dynamic field population
Overview
An Email Send connector connects to an SMTP server (user-specified or SendGrid) delivery service to send files as outgoing email messages. Input files processed by the connector can be sent directly as email attachments, or data can be parsed from input files and included in the outgoing message via a scripting template. For more information on creating a scripting template, see the Templates sections.OAuth 2.0 configuration for Outlook and Gmail mail servers are the two most common connection configurations made in the Email Send connector. You can access additional guides and resources for these two mail servers in the CData Community. See Using OAuth 2.0 in the Email Send and Receive Connectors.
Connector Configuration
This section contains all of the configurable connector properties.Email Config
Establish a Connection
To allow to send emails, you must first establish an Email Send connection. Once established, connections can be shared across multiple Email Send connectors. There are two ways to establish this connection:- Add an Email Send connector to your flow. Then use the Connection dropdown to select an existing connection or click Create to add a new connection.
- Open the Settings page, then open the Connections tab. Click Add, select Email Send, and click Next.
If you create the connection this way, you must still select it from the Connection dropdown on the connector.
| Setting | Description |
|---|---|
| Email Protocol | Whether to use a user-specified SMTP server or SendGrid. If you choose SendGrid, only TLS Type remains. All other fields are SMTP-related. |
| API Key | Your SendGrid API key. Not applicable for Cloud implementations. |
| Host | The hostname or IP address of the SMTP server. |
| Port | The port on which to connect to the SMTP server. Typical values include 143 and 993. |
| Authentication Mechanism | The type of authentication to use to login to the server. The options vary based on your choice. |
| Password | (Basic and NTLM) The password to the IMAP server. |
| Auth URL | (OAuth 2.0) The authorization URL for the service. This is the URL you are directed to when clicking the Connect button to log in and grant permission to the application. |
| Access Token URL | (OAuth 2.0) The URL to the access token. |
| Client Id | (OAuth 2.0) The client Id assigned when you registered for OAuth. |
| Client Secret | (OAuth 2.0) The secret assigned when you registered for OAuth. |
| Scope | (OAuth 2.0) A list of scopes that the application should have access to. |
| Callback URL | (OAuth 2.0) The URL where the service you connect to returns tokens to provide access. Services often require you to whitelist the URLs that are allowed, so this is the value to use when configuring the application registration with your service. |
| None | No authentication is required. |
| User | The username to login to the SMTP server. Not visible when the Authentication Mechanism is set to None. |
| TLS Type | The method used to negotiate TLS/SSL when connecting to the server: STARTTLS: A plain text connection is established. Afterwards, TLS/SSL can be started with an explicit command. SSL/TLS: Negotiation occurs immediately without first establishing a plain text connection. None (Plain Text): A plain text connection is established, and no TLS/SSL is used. Automatic: The appropriate TLS/SSL negotiation method is detected and applied based on the port number. STARTTLS is used for standard mail ports (25, 587), and TLS/SSL is used for port 465. |
- Host
- Port
- TLS Type
- User
- Password or OAuth 2.0 authentication credentials
- Mailbox
Additional Configuration
Settings for the outgoing email message. Most of these fields can include dynamic data from the outgoing file (see Dynamic Fields for more information).| Setting | Description |
|---|---|
| Message Type | Specifies the method for handling the message: Attachment: Send files that arrive at the connector as attachments. See Attachment Mode for more information and an example. Template: Interpret the message body as an Script template that reads values from the input file. For more information on creating a scripting template, see Template Mode. |
| To | The email address of the outgoing email message recipient. Use a comma-separated list to send to multiple recipients. |
| Show From | Opens a field to enter the email address of the sender of the outgoing email message. The connector attempts to automatically determine the value for this field based on the User credential passed to the SMTP server. |
| Show Cc / Show Bcc | Opens fields to enter an email address to carbon copy (CC) or blind carbon copy (BCC). Use a comma-separated list to send to multiple recipients. |
| Subject | The subject line for the outgoing email message. |
| Message Body | The email body. |
Settings Tab
Email Send Configuration
Settings for the name and description of the connector.Advanced Tab
Advanced Settings
Extra settings related to processing.| Setting | Description |
|---|---|
| Allow Script in Attachment mode | Check this to permit the evaluation of Script in the message body when the Message Type is Attachment. |
| Attachment Filter | A glob pattern filter to apply to messages before they are sent. The pattern can be positive or negative. For example, *.edi only sends files with a .edi extension and -*.tmp excludes files with a .tmp extension. You can provide a comma-separated list of filters. Later filters take priority unless you use an exact match. |
| Outgoing Server Public Certificate | The public key certificate used to verify the identity of a TLS/SSL server. If the target server uses TLS/SSL, set this field to the certificate that identifies the server. If the server’s certificate is not available, you can leave this setting blank to allow the underlying OS/JVM to perform certificate validation, or set it to Any Certificate to implicitly trust the server’s identity. |
| Extension Map | A comma separated list of name-value pairs for determining the Content-Type header value for attachments. For example, .txt=text/plain, .dat=application/edi-x12, .edi=application/edifact Note: Including a Content-Type header on input messages overrides the content type determined by this setting. |
| Processing Delay | The amount of time (in seconds) by which the processing of files placed in the Transactions tab is delayed. This is a legacy setting. Best practice is to use a File connector to manage local file systems instead of this setting. |
Proxy Settings
Logging
Miscellaneous
Automation Tab
Automation Settings
| Setting | Description |
|---|---|
| Send | A toggle that instructs the connector to automatically send files when they are ready. |
| Retry Interval | The interval the connector waits before retrying a failed send. |
| Max Attempts | The number of attempts the connector makes to send the message. Setting this value to 1 instructs the connector to only make the initial send attempt without retrying. The connector waits the duration specified by Retry Interval between each attempt. |
Performance
Alerts Tab
SLAs Tab
Transactions Tab
This tab lists all messages associated with the connector. Use the search bar to find specific messages, or click the funnel icon to apply a filter. You can filter by tracked headers, time, and/or status.Sending Emails
The Email Config tab determines the email message to be sent:- If Message Type is set to Attachment, files processed by the connector are sent as email attachments, and you should specify the body of the message in the message text editor. See Attachment Mode for more information.
- If Message Type is set to Template, the message text editor is treated as an Script template. In the scripting template, values can be parsed out from the files processed by the connector and included in the email body. See Template Mode for more information.
Dynamic Fields
The To, From, CC, BCC, and Subject fields support dynamic information from the outgoing file (for example, the filename and the connectors that have processed the file). The file information is available through the _message item. The _message item has a collection of attributes with aheader: prefix that corresponds to each of the headers available in the outgoing file. These headers include the filename, any metadata related to processing the file within the flow, and any custom headers promoted to the file via scripting.
The _message item and the header attributes are referenced in square brackets like any other Script item:
[_message.header:headerName]
For example, the Subject could be set to the following value to include the filename of the outgoing file:
[_message.header:filename]
Template Mode
Setting Message Type to Template instructs the connector to interpret the message body as an Script template. The template uses a simple syntax to interact with the input file and retrieve values to use in the email body. These values can be combined with static text to generate a standard body format that is dynamically populated based on the files processed by the connector. To use Template mode, the connector must receive an XML file as an input. Templates can only parse information from XML files.Basic Template
For an example of a template message, consider the following input XML document:Company, Email, FirstName, Description—inside of Lead tags. The Script expression to pass the Email field into a message would look like this:
[document.lead_email]
There are three components to this expression:
- The document item, which points to the currently open file.
- The lead_email attribute, which points to ‘john@abcinc.com’.
- Square brackets (
[]), which indicate the use of a formatter rather than literal characters.
XPath Formatting
The XPath formatter (written asxpath in expressions) provides an alternative approach to retrieving dynamic values from files. This approach might be more familiar to users already using Script elsewhere in . XPath requires input files to be XML files.
Using the same input file example as above:
[xpath(/Lead/Email)]
There are three components to this expression:
- xpath followed by parentheses, which denotes the expression as an XPath expression.
- The path to the data, with each level delineated by slashes.
- Square brackets (
[]), which indicate the use of a formatter rather than literal characters.
Using the XPath Formatter in Template Mode
Consider the following XML:Code View Editor
The Code View editor enables the creation of custom Script for advanced processing of information from XML files. To open the Code View editor, click the Code View button in the message editor.
Attachment Mode
If you set Message Type to Attachment, type your email message body into the editor. If necessary, you can reference headers on the input message to enrich the body of the email. The Email Send connector then evaluates those headers, and attaches the input file to the outbound email.This relies on a previous step in the flow to promote the necessary values as headers onto the message. Depending on the content of the file, you can do this with various Operations and connector settings.