Class MailUtil
java.lang.Object
com.jedox.etl.components.scriptapi.MailUtil
Deprecated, for removal: This API element is subject to removal in a future version.
Utility class to send emails via SMTP. Only SMTP user/password authentication
is supported.
Uses the SMTP settings from Scheduler as configured in Administration → Settings.
Get the utility with ExecutionAPI.getMailer()
, compose the email with
addRecipient(String)
, setSubject(String)
and
setMessage(String)
. After the email is complete, send it with
send()
.
mailer = API.getMailer(); mailer.addRecipient("max.mustermann@example.com"); mailer.setSubject("Hello"); mailer.setMessage("Hello from Jedox Integrator!"); mailer.send();
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addAttachment
(String filename) Deprecated, for removal: This API element is subject to removal in a future version.Adds an email attachment.void
addBccRecipient
(String recepient) Deprecated, for removal: This API element is subject to removal in a future version.Adds a blind carbon copy email recipient (Bcc)).void
addCcRecipient
(String recepient) Deprecated, for removal: This API element is subject to removal in a future version.Adds a carbon copy email recipient (Cc)).void
addRecipient
(String recepient) Deprecated, for removal: This API element is subject to removal in a future version.Adds an email recipient (To).void
enableAuth
(boolean auth) Deprecated, for removal: This API element is subject to removal in a future version.Enables authentication for the SMTP connection.void
enableTLS
(boolean tls) Deprecated, for removal: This API element is subject to removal in a future version.Enables TLS for the connection to the SMTP host.Deprecated, for removal: This API element is subject to removal in a future version.Returns the attachments added to the current email.Deprecated, for removal: This API element is subject to removal in a future version.Returns the list of blind carbon copy recipients.Deprecated, for removal: This API element is subject to removal in a future version.Returns the list of carbon copy recipients.Deprecated, for removal: This API element is subject to removal in a future version.Returns the email sender (From).Deprecated, for removal: This API element is subject to removal in a future version.Returns the list of email recipients (To).Deprecated, for removal: This API element is subject to removal in a future version.Returns the message text (BODY) of the email.Deprecated, for removal: This API element is subject to removal in a future version.Returns the MIME subtype (e.g.Deprecated, for removal: This API element is subject to removal in a future version.Returns the email subject.Deprecated, for removal: This API element is subject to removal in a future version.Returns the password for SMTP authentication.Deprecated, for removal: This API element is subject to removal in a future version.Returns the user for SMTP authentication.Deprecated, for removal: This API element is subject to removal in a future version.Returns the SMTP host name.Deprecated, for removal: This API element is subject to removal in a future version.Returns the SMTP port.boolean
isAuth()
Deprecated, for removal: This API element is subject to removal in a future version.Tests if authentication is enabled for the SMTP connection.boolean
isTls()
Deprecated, for removal: This API element is subject to removal in a future version.Tests if TLS is enabled for the connection to the SMTP host.boolean
Deprecated, for removal: This API element is subject to removal in a future version.Tests if the SMTP connection is configured to trust the configured SMTP host.void
reset()
Deprecated, for removal: This API element is subject to removal in a future version.Reset the current email fields.void
send()
Deprecated, for removal: This API element is subject to removal in a future version.Sends an email once its composition is complete.void
setMessage
(String message) Deprecated, for removal: This API element is subject to removal in a future version.Sets the email body.void
setMessage
(String message, String subType) Deprecated, for removal: This API element is subject to removal in a future version.Sets the email body.void
Deprecated, for removal: This API element is subject to removal in a future version.Sets the From address of the email.void
Deprecated.This method is deprecated and will be removed.void
Deprecated, for removal: This API element is subject to removal in a future version.This method is deprecated and will be removed.void
setSMTPServer
(String host, String port, String user, String password) Deprecated, for removal: This API element is subject to removal in a future version.Sets required configuration values for the SMTP connection.void
setSubject
(String subject) Deprecated, for removal: This API element is subject to removal in a future version.Sets the email subject.void
trustAllServers
(boolean trustAllServers) Deprecated, for removal: This API element is subject to removal in a future version.Configures the SMTP connection to trust the configured SMTP host.
-
Method Details
-
setServer
Deprecated, for removal: This API element is subject to removal in a future version.This method is deprecated and will be removed. UsesetSMTPServer(String, String, String, String)
instead.Sets SMTP host and user and password.- Parameters:
host
- the SMTP hostuser
- the user for authenticationpassword
- the password for authentication
-
setSMTPServer
Deprecated, for removal: This API element is subject to removal in a future version.Sets required configuration values for the SMTP connection.- Parameters:
host
- the SMTP hostport
- the port to useuser
- the user for authentication, ifsender
(From) is not explicitly set, this value is also used forsender
(From)password
- the password for authentication
-
setSender
Deprecated, for removal: This API element is subject to removal in a future version.Sets the From address of the email.- Parameters:
sender
- the email address of the sender (From)
-
addRecipient
Deprecated, for removal: This API element is subject to removal in a future version.Adds an email recipient (To). This method can be called multiple times to add more than one recipient.- Parameters:
recepient
- email address of a recipient (To)
-
addCcRecipient
Deprecated, for removal: This API element is subject to removal in a future version.Adds a carbon copy email recipient (Cc)). This method can be called multiple times to add more than one carbon copy recipient.- Parameters:
recepient
- email address of a carbon copy recipient (Cc)
-
addBccRecipient
Deprecated, for removal: This API element is subject to removal in a future version.Adds a blind carbon copy email recipient (Bcc)). This method can be called multiple times to add more than one carbon copy recipient.- Parameters:
recepient
- email address of a blind carbon copy recipient (Bcc)
-
addAttachment
Deprecated, for removal: This API element is subject to removal in a future version.Adds an email attachment. This method can be called multiple times to add more than one email attachment.- Parameters:
filename
- the filename of the attachment (e.g. filename.txt), the path (similar to file-based connections with location typeFileSystem
) is relative to the local files folder- Throws:
MailUtil.MailException
- if the file doesn't exist
-
setSubject
Deprecated, for removal: This API element is subject to removal in a future version.Sets the email subject.- Parameters:
subject
- the subject of the email
-
setMessage
Deprecated, for removal: This API element is subject to removal in a future version.Sets the email body.- Parameters:
message
- the text of the email body
-
setMessage
Deprecated, for removal: This API element is subject to removal in a future version.Sets the email body.- Parameters:
message
- the text of the email bodysubType
- the MIME subtype to use (e.g."html"
)
-
enableTLS
public void enableTLS(boolean tls) Deprecated, for removal: This API element is subject to removal in a future version.Enables TLS for the connection to the SMTP host.- Parameters:
tls
-true
to enable TLS,false
otherwise
-
enableAuth
public void enableAuth(boolean auth) Deprecated, for removal: This API element is subject to removal in a future version.Enables authentication for the SMTP connection.- Parameters:
auth
-true
to enable authentication,false
otherwise
-
trustAllServers
public void trustAllServers(boolean trustAllServers) Deprecated, for removal: This API element is subject to removal in a future version.Configures the SMTP connection to trust the configured SMTP host. If disabled, trust depends on the certificate the server presents.- Parameters:
trustAllServers
-true
to trust the configured SMTP host,false
to trust the SMTP host depending on the certificate it presents
-
send
Deprecated, for removal: This API element is subject to removal in a future version.Sends an email once its composition is complete.- Throws:
MailUtil.MailException
- if an error occurs while sending the email via SMTP
-
reset
public void reset()Deprecated, for removal: This API element is subject to removal in a future version.Reset the current email fields. Does not reset the configuration properties of the SMTP connection. -
setServer
Deprecated.This method is deprecated and will be removed. -
getSmtpHostName
Deprecated, for removal: This API element is subject to removal in a future version.Returns the SMTP host name.- Returns:
- the SMTP host name
-
getSmtpPort
Deprecated, for removal: This API element is subject to removal in a future version.Returns the SMTP port.- Returns:
- the SMTP port
-
getSmtpAuthUser
Deprecated, for removal: This API element is subject to removal in a future version.Returns the user for SMTP authentication.- Returns:
- the user for authentication
-
getSmtpAuthPwd
Deprecated, for removal: This API element is subject to removal in a future version.Returns the password for SMTP authentication.- Returns:
- the password for authentication
-
getEmailMsgTxt
Deprecated, for removal: This API element is subject to removal in a future version.Returns the message text (BODY) of the email.- Returns:
- the message text of the email
-
getEmailMsgTxtSubType
Deprecated, for removal: This API element is subject to removal in a future version.Returns the MIME subtype (e.g."html"
) of the email.- Returns:
- the MIME subtype of the email
-
getEmailSubjectTxt
Deprecated, for removal: This API element is subject to removal in a future version.Returns the email subject.- Returns:
- the email subject
-
getEmailFromAddress
Deprecated, for removal: This API element is subject to removal in a future version.Returns the email sender (From).- Returns:
- the email sender (From)
-
isTls
public boolean isTls()Deprecated, for removal: This API element is subject to removal in a future version.Tests if TLS is enabled for the connection to the SMTP host.- Returns:
true
if TLS is enabled,false
otherwise
-
isAuth
public boolean isAuth()Deprecated, for removal: This API element is subject to removal in a future version.Tests if authentication is enabled for the SMTP connection.- Returns:
true
if authentication is enabled,false
otherwise
-
isTrustAllServers
public boolean isTrustAllServers()Deprecated, for removal: This API element is subject to removal in a future version.Tests if the SMTP connection is configured to trust the configured SMTP host. If disabled, trust depends on the certificate the server presents- Returns:
true
if the SMTP connection is configured to trust the configured SMTP host,false
otherwise
-
getEmailList
Deprecated, for removal: This API element is subject to removal in a future version.Returns the list of email recipients (To).- Returns:
- the list of email recipients (To) as a
Set
-
getCcList
Deprecated, for removal: This API element is subject to removal in a future version.Returns the list of carbon copy recipients.- Returns:
- the list of carbon copy recipients as a
Set
-
getBccList
Deprecated, for removal: This API element is subject to removal in a future version.Returns the list of blind carbon copy recipients.- Returns:
- the list of blind carbon copy recipients as a
Set
-
getAttachmentsList
Deprecated, for removal: This API element is subject to removal in a future version.Returns the attachments added to the current email.- Returns:
- the list of attachments of the current email
-