Package org.crazyyak.dev.net.email

Examples of org.crazyyak.dev.net.email.EmailMessage


    }

    String apiMessage = null;
    SmtpEmailConfig config = apiClient.getSmtpEmailConfig();

    EmailMessage message;

    if (StringUtils.isNotBlank(config.getRecipientOverride())) {
      // This is NOT a "production" request.
      message = new EmailMessage(config.getServerName(), config.getPortNumber(), config.getRecipientOverride());
      apiMessage = String.format("Request sent to recipient override, %s.", config.getRecipientOverride());
    } else {
      // This IS a "production" request.
      message = new EmailMessage(config.getServerName(), config.getPortNumber(), push.getToAddress());
    }

    if (config.getAuthType().isTls()) {
      message.setAuthentication(AuthenticationMethod.TLS, config.getUserName(), config.getPassword());
    } else if (config.getAuthType().isSsl()) {
      message.setAuthentication(AuthenticationMethod.SSL, config.getUserName(), config.getPassword());
    } else {
      message.setAuthentication(AuthenticationMethod.NONE, config.getUserName(), config.getPassword());
    }

    message.setFrom(push.getFromAddress());
    message.send("", push.getMessage(), null);

    return apiRequest.processed(apiMessage);
  }
View Full Code Here


      SmtpEmailConfig config = apiClient.getSmtpEmailConfig();
      if (config == null) {
        throw new UnsupportedOperationException("AWS e-mail configuration was not specified.");
      }

      EmailMessage message = new EmailMessage(config.getServerName(), config.getPortNumber(), "jacob.parr@gmail.com");

      if (config.getAuthType().isTls()) {
        message.setAuthentication(AuthenticationMethod.TLS, config.getUserName(), config.getPassword());
      } else if (config.getAuthType().isSsl()) {
        message.setAuthentication(AuthenticationMethod.SSL, config.getUserName(), config.getPassword());
      } else {
        message.setAuthentication(AuthenticationMethod.NONE, config.getUserName(), config.getPassword());
      }

      message.setFrom("Munchie Monster Support <support@munchiemonster.com>");
      String subject = "New Story for " + userName;
      message.send(subject, null, htmlContent);

    } catch (Throwable e) {
      e.printStackTrace();
    }
  }
View Full Code Here

    }

    String apiMessage = null;
    SmtpEmailConfig config = apiClient.getSmtpEmailConfig();

    EmailMessage message;

    if (StringUtils.isNotBlank(config.getRecipientOverride())) {
      // This is NOT a "production" request.
      message = new EmailMessage(config.getServerName(), config.getPortNumber(), config.getRecipientOverride());
      apiMessage = String.format("Request sent to recipient override, %s.", config.getRecipientOverride());
    } else {
      // This IS a "production" request.
      message = new EmailMessage(config.getServerName(), config.getPortNumber(), push.getToAddress());
    }

    if (config.getAuthType().isTls()) {
      message.setAuthentication(AuthenticationMethod.TLS, config.getUserName(), config.getPassword());
    } else if (config.getAuthType().isSsl()) {
      message.setAuthentication(AuthenticationMethod.SSL, config.getUserName(), config.getPassword());
    } else {
      message.setAuthentication(AuthenticationMethod.NONE, config.getUserName(), config.getPassword());
    }

    message.setFrom(push.getFromAddress());
    message.send(push.getEmailSubject(), null, push.getHtmlContent());

    return apiRequest.processed(apiMessage);
  }
View Full Code Here

TOP

Related Classes of org.crazyyak.dev.net.email.EmailMessage

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.