Class SmtpConfig

java.lang.Object
org.mapfish.print.config.SmtpConfig
All Implemented Interfaces:
ConfigurationObject

public class SmtpConfig extends Object implements ConfigurationObject
Email sending configuration.

This configuration is needed only if reports are to be sent to the user by email.

  • Field Details

  • Constructor Details

    • SmtpConfig

      public SmtpConfig()
  • Method Details

    • validate

      public void validate(List<Throwable> validationErrors, Configuration configuration)
      Description copied from interface: ConfigurationObject
      validate that the configuration was correct.
      Specified by:
      validate in interface ConfigurationObject
      Parameters:
      validationErrors - a list to add any detected errors to.
      configuration - the containing configuration
    • getFromAddress

      public String getFromAddress()
    • setFromAddress

      public void setFromAddress(String fromAddress)
      The email address used as "From:" in every email.
      Parameters:
      fromAddress - The address
    • getHost

      public String getHost()
    • setHost

      public void setHost(String host)
      The SMTP server hostname.
      Parameters:
      host - The host
    • getPort

      public int getPort()
    • setPort

      public void setPort(int port)
      The TCP port of the SMTP server.
      Parameters:
      port - The port
    • getUsername

      public String getUsername()
    • setUsername

      public void setUsername(String username)
      If auth is needed, the username.
      Parameters:
      username - The username
    • getPassword

      public String getPassword()
    • setPassword

      public void setPassword(String password)
      If auth is needed, the password.
      Parameters:
      password - The password
    • isStarttls

      public boolean isStarttls()
    • setStarttls

      public void setStarttls(boolean starttls)
      True to use STARTTLS.
      Parameters:
      starttls - Whatever
    • isSsl

      public boolean isSsl()
    • setSsl

      public void setSsl(boolean ssl)
      True for enabling SSL.
      Cannot be enabled at the same time as starttls
      Parameters:
      ssl - The value
    • getSubject

      @Nonnull public String getSubject()
    • setSubject

      public void setSubject(@Nonnull String subject)
      The default email subject.
      This can be changed by the smtp.subject property in the request.
      Parameters:
      subject - The subject
    • getBody

      @Nonnull public String getBody()
      Returns the configured body or the default value.
    • setBody

      public void setBody(String body)
      The default email body.
      This can be changed by the smtp.body property in the request.

      If you have setup a storage, you must put a "{url}" marker where the URL to fetch the report should be put.

      Parameters:
      body - The body
    • getStorage

      @Nullable public ReportStorage getStorage()
    • setStorage

      public void setStorage(ReportStorage storage)
      The report storage facility to use.
      By default, attaches the report in an email. But, for big files, this is not practical. This can be used to configure a storage.
      Parameters:
      storage - The storage to use
    • getErrorSubject

      @Nonnull public String getErrorSubject()
    • setErrorSubject

      public void setErrorSubject(@Nonnull String errorSubject)
      The default email subject in case of error.
      This can be changed by the smtp.errorSubject property in the request.
      Parameters:
      errorSubject - The subject
    • getErrorBody

      @Nonnull public String getErrorBody()
    • setErrorBody

      public void setErrorBody(@Nonnull String errorBody)
      The default email body in case of error.
      This can be changed by the smtp.body property in the request.

      The error message can be places in the text using a "{message}" marker.

      Parameters:
      errorBody - The body