////
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at
  http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
////
:documentationPath: /pipeline/transforms/
:language: en_US
:description: The Mail transform uses an SMTP server to send an email using data from the pipeline fields.

= image:transforms/icons/mail.svg[Mail transform Icon, role="image-doc-icon"] Mail

[%noheader,cols="3a,1a", role="table-no-borders" ]
|===
|
== Description

The Mail transform uses an SMTP server to send an email using data from the pipeline fields.

|
== Supported Engines
[%noheader,cols="2,1a",frame=none, role="table-supported-engines"]
!===
!Hop Engine! image:check_mark.svg[Supported, 24]
!Spark! image:question_mark.svg[Maybe Supported, 24]
!Flink! image:question_mark.svg[Maybe Supported, 24]
!Dataflow! image:question_mark.svg[Maybe Supported, 24]
!===
|===

== Options

=== Addresses

This tab defines the sender, contact person, and recipients of a Hop-generated email.

[options="header"]
|===
|Option|Description
|Transform name|Name of the transform.
|Destination address|The destination for the email.
This can be a single address, a space-separated list of addresses , or an email alias for a distribution list
|Cc|An email address, space-separated list of email addresses, or a distribution list to send a carbon copy of the email to.
|Bcc|An email address, space-separated list of email addresses, or a distribution list to send a blind carbon copy of the email to.
|Sender name|The name of the person you want the email to be from.
|Sender Address|The email address of the person or account you want the email to be from.
|Reply to|The email address that recipients will use if they reply to the email.
|Contact|The name of the person to contact regarding the email's contents.
|Contact phone|The phone number of the contact person defined in the previous field.
|===

=== Server

This tab contains details for your SMTP server, including authentication and encryption.

[options="header"]
|===
|Option|Description
|SMTP server|URL, hostname, or IP address of your SMTP server.
|Port|Port number for your SMTP service.
|Use authentication|If checked, you will be able to enter an SMTP username and password in the next few fields.
|Use XOAUTH2 |If checked XOAuth2 will be used to authenticate with the server.
|Authentication user|The SMTP username to use for server authentication.
|Authentication password|The password for the previously defined SMTP username.
|Use secure authentication|If checked you will be able to specify SSL or TLS encryption in the next field.
|Secure connection type|Determines whether the server will use SSL or TLS encryption protocols.
|===

=== Email Message

This tab determines the text content of the email.

[options="header"]
|===
|Option|Description
|Include date in message?|If checked, the date will be printed in the email body.
|Only send comment in mail body|If checked, information about the pipeline will not be included.
|Use HTML format in mail body?|If checked, this email will be in HTML format instead of plain text.
|Encoding|Character encoding for the text of an HTML email.
|Manage priority|If checked, enables the following two fields to set email priority and importance levels.
|Priority|The priority level to assign in the email metadata.
|Importance|The importance level to assign in the email metadata.
|Sensitivity|This allows to set the "Sensitivity" header information to Normal, Personal, Private, Confidential.
|Subject|The email subject line.
|Comment|The email body.
See also the option "Attach content file".
|===

=== Attached Files

This tab contains options for file attachments.

[options="header"]
|===
|Option|Description
|Attach content file?|If checked, you will use the next two fields to define which stream fields you want to use to create dynamic content of the mail message.
|Content fieldname|The given field contains the field that points to a file that is loaded for the content.
Internally this file content is put into is MimeBodyPart (using application/x-any).
|Filename fieldname|This field sets the filename within the MimeBodyPart.
|Dynamic filenames?|If checked, you will use the next two fields to define which stream fields you want to use to create dynamic filenames for your attachments.
|Filename field|The stream field you want to use for dynamic filenames of attachments.
This can also be a folder name, in which case you would use the Wildcard field to determine filenames.
|Wildcard field|A regular expression that creates dynamic filenames for attachments.
|Filename/foldername|A static name and location of a file to attach.
|Include subfolders|If checked, will attach files in subfolders of the specified folder.
|Wildcard|A regular expression that identifies a file to attach.
|Zip files|If checked, multiple file attachments will be zipped into a single archive before attaching to the email.
|Is zip filename dynamic?|If checked, the name of the zip archive will be determined by a data stream.
|Zipfilename field|The data field to use for the name of the zip archive.
|Zip filename|A static name for the zip archive.
|Zip files if size greater than|Only archives file attachments if their combined size is above this number (in bytes).
|===

=== Embedded Images

This tab contains options for embedded images in HTML emails.

[options="header"]
|===
|Option|Description
|Filename|The name and location of the file you want to embed in the email.
|Content ID|A unique identifier for this file.
Hop will generate one if you don't specify one yourself.
|#|The order that the attachment will be processed.
|Image|The name of as added image.
|Content ID (field)|The content ID of an added image.
|===