Class MailUtil

java.lang.Object
com.jedox.etl.components.scriptapi.MailUtil

@Deprecated(forRemoval=true) public class MailUtil extends Object
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 AdministrationSettings.

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 Type
    Method
    Description
    void
    Deprecated, for removal: This API element is subject to removal in a future version.
    Adds an email attachment.
    void
    Deprecated, for removal: This API element is subject to removal in a future version.
    Adds a blind carbon copy email recipient (Bcc)).
    void
    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
    Deprecated, for removal: This API element is subject to removal in a future version.
    Tests if authentication is enabled for the SMTP connection.
    boolean
    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
    Deprecated, for removal: This API element is subject to removal in a future version.
    Reset the current email fields.
    void
    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
    setSender(String sender)
    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
    setServer(String host, String user, String password)
    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.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • setServer

      @Deprecated(forRemoval=true) public void setServer(String host, String user, String password)
      Deprecated, for removal: This API element is subject to removal in a future version.
      This method is deprecated and will be removed. Use setSMTPServer(String, String, String, String) instead.
      Sets SMTP host and user and password.
      Parameters:
      host - the SMTP host
      user - the user for authentication
      password - the password for authentication
    • setSMTPServer

      public 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.
      Parameters:
      host - the SMTP host
      port - the port to use
      user - the user for authentication, if sender (From) is not explicitly set, this value is also used for sender (From)
      password - the password for authentication
    • setSender

      public void setSender(String sender)
      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

      public void addRecipient(String recepient)
      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

      public 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)). 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

      public 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)). 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

      public void addAttachment(String filename) throws MailUtil.MailException
      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 type FileSystem) is relative to the local files folder
      Throws:
      MailUtil.MailException - if the file doesn't exist
    • setSubject

      public void setSubject(String subject)
      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

      public void setMessage(String message)
      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

      public void setMessage(String message, String subType)
      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
      subType - 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

      public void send() throws MailUtil.MailException
      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 public void setServer()
      Deprecated.
      This method is deprecated and will be removed.
    • getSmtpHostName

      public String 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

      public String getSmtpPort()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns the SMTP port.
      Returns:
      the SMTP port
    • getSmtpAuthUser

      public String 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

      public String 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

      public String 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

      public String 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

      public String getEmailSubjectTxt()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns the email subject.
      Returns:
      the email subject
    • getEmailFromAddress

      public String 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

      public Set<String> 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

      public Set<String> 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

      public Set<String> 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

      public Set<File> 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