*
* @return a MailConfig starting from the action form fields.
* @throws ApsSystemException In case of errors.
*/
protected MailConfig prepareConfig() throws ApsSystemException {
MailConfig config = this.getMailManager().getMailConfig();
config.setActive(this.isActive());
config.setDebug(this.isDebug());
config.setSmtpHost(this.getSmtpHost());
config.setSmtpPort(this.getSmtpPort());
config.setSmtpTimeout(this.getSmtpTimeout());
config.setSmtpProtocol(this.getSmtpProtocol());
if (StringUtils.isBlank(this.getSmtpUserName()) && StringUtils.isBlank(this.getSmtpPassword())) {
config.setSmtpUserName(this.getSmtpUserName());
config.setSmtpPassword(this.getSmtpPassword());
} else {
if (StringUtils.isNotBlank(this.getSmtpPassword())) {
config.setSmtpPassword(this.getSmtpPassword());
}
if (!config.getSmtpUserName().equals(this.getSmtpUserName())) {
config.setSmtpUserName(this.getSmtpUserName());
}
}
return config;
}