Package org.mapfish.print.config
Class SmtpConfig
- java.lang.Object
-
- org.mapfish.print.config.SmtpConfig
-
- All Implemented Interfaces:
ConfigurationObject
public class SmtpConfig extends java.lang.Object implements ConfigurationObject
Email sending configuration.This configuration is needed only if reports are to be sent to the user by email.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DEFAULT_BODY
The default body.static java.lang.String
DEFAULT_BODY_STORAGE
The default body if there is a storage.static java.lang.String
DEFAULT_ERROR_BODY
The default body in case of error.static java.lang.String
DEFAULT_ERROR_SUBJECT
The default subject in case of error.static java.lang.String
DEFAULT_SUBJECT
The default subject.
-
Constructor Summary
Constructors Constructor Description SmtpConfig()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getBody()
Returns the configured body or the default value.java.lang.String
getErrorBody()
java.lang.String
getErrorSubject()
java.lang.String
getFromAddress()
java.lang.String
getHost()
java.lang.String
getPassword()
int
getPort()
ReportStorage
getStorage()
java.lang.String
getSubject()
java.lang.String
getUsername()
boolean
isSsl()
boolean
isStarttls()
void
setBody(java.lang.String body)
The default email body.void
setErrorBody(java.lang.String errorBody)
The default email body in case of error.void
setErrorSubject(java.lang.String errorSubject)
The default email subject in case of error.void
setFromAddress(java.lang.String fromAddress)
The email address used as "From:" in every email.void
setHost(java.lang.String host)
The SMTP server hostname.void
setPassword(java.lang.String password)
If auth is needed, the password.void
setPort(int port)
The TCP port of the SMTP server.void
setSsl(boolean ssl)
True for enabling SSL.void
setStarttls(boolean starttls)
True to use STARTTLS.void
setStorage(ReportStorage storage)
The report storage facility to use.void
setSubject(java.lang.String subject)
The default email subject.void
setUsername(java.lang.String username)
If auth is needed, the username.void
validate(java.util.List<java.lang.Throwable> validationErrors, Configuration configuration)
validate that the configuration was correct.
-
-
-
Field Detail
-
DEFAULT_SUBJECT
public static final java.lang.String DEFAULT_SUBJECT
The default subject.- See Also:
- Constant Field Values
-
DEFAULT_BODY
public static final java.lang.String DEFAULT_BODY
The default body.- See Also:
- Constant Field Values
-
DEFAULT_BODY_STORAGE
public static final java.lang.String DEFAULT_BODY_STORAGE
The default body if there is a storage.- See Also:
- Constant Field Values
-
DEFAULT_ERROR_SUBJECT
public static final java.lang.String DEFAULT_ERROR_SUBJECT
The default subject in case of error.- See Also:
- Constant Field Values
-
DEFAULT_ERROR_BODY
public static final java.lang.String DEFAULT_ERROR_BODY
The default body in case of error.- See Also:
- Constant Field Values
-
-
Method Detail
-
validate
public void validate(java.util.List<java.lang.Throwable> validationErrors, Configuration configuration)
Description copied from interface:ConfigurationObject
validate that the configuration was correct.- Specified by:
validate
in interfaceConfigurationObject
- Parameters:
validationErrors
- a list to add any detected errors to.configuration
- the containing configuration
-
getFromAddress
public java.lang.String getFromAddress()
-
setFromAddress
public void setFromAddress(java.lang.String fromAddress)
The email address used as "From:" in every email.- Parameters:
fromAddress
- The address
-
getHost
public java.lang.String getHost()
-
setHost
public void setHost(java.lang.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 java.lang.String getUsername()
-
setUsername
public void setUsername(java.lang.String username)
If auth is needed, the username.- Parameters:
username
- The username
-
getPassword
public java.lang.String getPassword()
-
setPassword
public void setPassword(java.lang.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 asstarttls
- Parameters:
ssl
- The value
-
getSubject
@Nonnull public java.lang.String getSubject()
-
setSubject
public void setSubject(@Nonnull java.lang.String subject)
The default email subject.
This can be changed by thesmtp
.subject
property in the request.- Parameters:
subject
- The subject
-
getBody
@Nonnull public java.lang.String getBody()
Returns the configured body or the default value.
-
setBody
public void setBody(java.lang.String body)
The default email body.
This can be changed by thesmtp
.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 java.lang.String getErrorSubject()
-
setErrorSubject
public void setErrorSubject(@Nonnull java.lang.String errorSubject)
The default email subject in case of error.
This can be changed by thesmtp
.errorSubject
property in the request.- Parameters:
errorSubject
- The subject
-
getErrorBody
@Nonnull public java.lang.String getErrorBody()
-
setErrorBody
public void setErrorBody(@Nonnull java.lang.String errorBody)
The default email body in case of error.
This can be changed by thesmtp
.body
property in the request.The error message can be places in the text using a "{message}" marker.
- Parameters:
errorBody
- The body
-
-