Home | Table of Contents | EmailSender | CloverETL 4.6.1
--- | --- | ---
Prev | Writers | Next

## EmailSender

# Not available in Community Designer

Short Description
Ports
Metadata
EmailSender Attributes
Details
See also

### Short Description

EmailSender sends e-mails.

Component | Data output | Input ports | Output ports | Transformation | Transf. required | Java | CTL | Auto-propagated metadata
--- | --- | --- | --- | --- | --- | --- | --- | ---
EmailSender | flat file | 0-1 | 0-2 |  |  |  |  |

### Icon

### Ports

Port type | Number | Required | Description | Metadata
--- | --- | --- | --- | ---
Input | 0 |  | For data for e-mails | Any
Output | 0 |  | For successfully sent e-mails. | Input 0
1 |  | For rejected e-mails. | Input 0 plus field named `errorMessage`

### Metadata

EmailSender does not propagate metadata.

EmailSender has no metadata templates.

Metadata of the first output port are the same as those of the input port. However, metadata are not propagated from the input port to the first output port.

Metadata of the second output port have the same fields as metadata of the input port plus one field named "errorMessage". This field receives the information about the error that has occurred.

### EmailSender Attributes

Attribute | Req | Description | Possible values
--- | --- | --- | ---
Basic
SMTP server | yes | Name of SMTP server for outgoing e-mails. | e.g. smtp.example.com
SMTP user |  | Name of the user for an authenticated SMTP server. |
SMTP password |  | Password of the user for an authenticated SMTP server. |
Connection security |  | Specifies the security protocol used to connect to the server. | None (default) | STARTTLS | SSL
Message | yes | Set of properties defining the message headers and body. See E-Mail Message for more information. |
Attachments |  | Set of properties defining the message attachments. See E-Mail Attachments for more information. |
Advanced
SMTP port |  | Number of the port used for connection to SMTP server. | Integers
Trust invalid SMTP server certificate |  | By default, invalid SMTP server certificates are not accepted. If set to `true`, invalid SMTP server certificate (with different name, expired, etc) is accepted. | false (default) | true
Ignore send fail |  | By default, when an e-mail is not successfully sent, graph fails. If set to `true`, graph execution stops even if no mail can be sent successfully. | false (default) | true

### Details

E-Mail Message
E-Mail Attachments
JavaMail System Properties

EmailSender converts data records into e-mails. It can use input data to create the e-mail sender and addressee, e-mail subject, message body, and attachment(s). If no input edge is connected, this component sends one e-mail.

If a record is rejected and an e-mail is not sent, an error message is created and sent to the `errorMessage` field of metadata on the output 1 (if it contains such a field).

#### E-Mail Message

To define the Message attribute, you can use the following wizard:

Figure 49.5. EmailSender Message Wizard

In this wizard, you specify content of particular parts of an email message: drag and drop the proper field from Fields pane to the Value column.

You can also specify values to be used if the mapped field is empty. The alternative values of these attributes should be typed to Alternative column. If some field is empty or has null value, the Alternative is used instead of the field value.

You can add additional headers using plus button. This way you set up Cc or Bcc.

The resulting value of the Message attribute will look like this:

    From=$From|my@mail.com Subject=$Subject|mySubject To=$To|toWhom MessageBody=$Message|myText

| Tip
To send an email to multiple recipients, separate their addresses by comma ','. If needed, use the same delimiter in the `Cc` and `Bcc` fields.

| Note
Each field in Properties table can be used as a template. Variable names are substituted with values from record. For example MessageBody field contains `Hello, my name is $name.` and field name in input record has value Bob. The output message will contain text `Hello, my name is Bob.`

#### E-Mail Attachments

Attachments attribute lets you add files as an e-mail attachment.

The attachment can be a file with invariable path (static file) or a file whose name is received from an edge or a file whose content is received from an edge. These ways can be arbitrarily combined.

The attachment is specified as a sequence of individual attachments separated by semicolon. It is defined as a field name (file name received from an edge) or as a file name including its path or as a triplet of field name, file name of the attachment and its mime type. Each of these three parts of the triplet can be also specified using a static expression.

The attachments is added to the e-mail using the following Edit attachments wizard:

Figure 49.6. Edit Attachments Wizard

You add the items by clicking the Plus sign button and remove by clicking the Minus sign button. Input fields can be dragged to the Attachment column of the Attachments pane or the Arrow button can be used.

If you want to edit any attachment definition, click the corresponding row in the Attachment column and the following attribute will open:

Figure 49.7. Attachment Wizard

In this wizard, you need to locate files, specify them using field names or the mentioned triplet. After clicking OK, the attachment is defined.

If you want to use non-ASCII characters in filenames of attachments, value of the system property `mail.mime.encodefilename` needs to be set to `true`. Any non-ASCII characters in the filenames will be encoded then (default is `false`).

Default MIME charset to use for encoded words and text parts that don't otherwise specify a charset (not only filename, but subject, message body as well) can be specified using the `mail.mime.charset` system property. Default value is the value of the `file.encoding` system property.

#### JavaMail System Properties

The EmailSender component is implemented using the JavaMail reference implementation library. JavaMail specification lists Java system properties which control behavior of the JavaMail implementation, see the JavaMail API documentation for description of these properties. Use `-D` Java VM parameter to set value of a system property.

#### Notes and Limitations

Metadata of EmailSender can have list and map fields. Map and list fields can be passed through, but they are not suitable for use in the component.

### See also

EmailReader
Common Properties of Components
Specific Attribute Types
Common Properties of Writers
Writers Comparison

Prev | Up | Next
DBOutputTable | Home | Table of Contents | FlatFileWriter