Package com.agiletec.plugins.jpmail.aps.services.mail

Examples of com.agiletec.plugins.jpmail.aps.services.mail.MailConfig


public class SmtpConfigAction extends BaseAction implements ISmtpConfigAction {

  @Override
  public String edit() {
    try {
      MailConfig config = this.getMailManager().getMailConfig();
      this.populateForm(config);
    } catch (Throwable t) {
      ApsSystemUtils.logThrowable(t, this, "edit");
      return FAILURE;
    }
View Full Code Here


  }

  @Override
  public String save() {
    try {
      MailConfig config = this.prepareConfig();
      this.getMailManager().updateMailConfig(config);
      this.addActionMessage(this.getText("message.eMailConfig.savedConfirm"));
    } catch (Throwable t) {
      ApsSystemUtils.logThrowable(t, this, "save");
      return FAILURE;
View Full Code Here

    return SUCCESS;
  }

  @Override
  public String testSmtp() {
    MailConfig config;
    try {
      config = this.prepareConfig();
      boolean smtpServerTest = this.getMailManager().smtpServerTest(config);
      if (!smtpServerTest) {
        this.addActionError(this.getText("note.smtp.ko"));
View Full Code Here

      this.setSmtpTimeout(config.getSmtpTimeout());
      this.setSmtpUserName(config.getSmtpUserName());
      this.setSmtpPassword(config.getSmtpPassword());
      this.setSmtpProtocol(config.getSmtpProtocol());
    } else {
      config = new MailConfig();
    }
  }
View Full Code Here

   *
   * @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;
  }
View Full Code Here

  }
 
  @Override
  public String edit() {
    try {
      MailConfig config = this.getConfig();
      String code = this.getCode();
      String mail = config.getSender(code);
      if (mail==null || mail.length()==0) {
        this.addActionError(this.getText("error.config.sender.notExists"));
        return ERROR;
      }
      this.setCode(code);
View Full Code Here

  }
 
  @Override
  public String save() {
    try {
      MailConfig config = this.prepareConfig();
      this.getMailManager().updateMailConfig(config);
    } catch (Throwable t) {
      ApsSystemUtils.logThrowable(t, this, "save");
      return FAILURE;
    }
View Full Code Here

  }
 
  @Override
  public String trash() {
    try {
      MailConfig config = this.getConfig();
      String code = this.getCode();
      if (null == code && null == config.getSender(code)) {
        this.addActionError(this.getText("error.config.sender.notExists"));
        return INPUT;
      }
    } catch (Throwable t) {
      ApsSystemUtils.logThrowable(t, this, "remove");
View Full Code Here

  }
 
  @Override
  public String delete() {
    try {
      MailConfig config = this.getConfig();
      String code = this.getCode();
      if (null == code && null == config.getSender(code)) {
        this.addActionError(this.getText("error.config.sender.notExists"));
        return INPUT;
      } else {
        config.getSenders().remove(code);
        this.getMailManager().updateMailConfig(config);
      }
    } catch (Throwable t) {
      ApsSystemUtils.logThrowable(t, this, "remove");
      return FAILURE;
View Full Code Here

   * Prepares a MailConfig starting from the action form fields.
   * @return a MailConfig starting from the action form fields.
   * @throws ApsSystemException In case of errors.
   */
  protected MailConfig prepareConfig() throws ApsSystemException {
    MailConfig config = this.getConfig();
    Map<String, String> senders = config.getSenders();
    String code = this.getCode();
    String mail = this.getMail();
    senders.put(code, mail);
    return config;
  }
View Full Code Here

TOP

Related Classes of com.agiletec.plugins.jpmail.aps.services.mail.MailConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.