Package com.cosmicpush.app.domain.clients.config

Examples of com.cosmicpush.app.domain.clients.config.AwsEmailConfig


    if (StringUtils.isNotBlank(reasonNotPermitted)) {
      return apiRequest.denyRequest(reasonNotPermitted);
    }

    String apiMessage = null;
    AwsEmailConfig config = apiClient.getAwsEmailConfig();

    Body body = new Body();
    if (StringUtils.isBlank(action.getHtmlContent())) {
      body.withText(new Content().withCharset("UTF-8").withData("-no message-"));
    } else {
      body.withHtml(new Content().withCharset("UTF-8").withData(action.getHtmlContent()));
    }

    SendEmailRequest sendEmailRequest = new SendEmailRequest();
    sendEmailRequest.withSource(action.getFromAddress());
    sendEmailRequest.withReturnPath(action.getFromAddress());
    sendEmailRequest.withReplyToAddresses(action.getFromAddress());


    if (StringUtils.isNotBlank(config.getRecipientOverride())) {
      // This is NOT a "production" request.
      sendEmailRequest.setDestination(new Destination().withToAddresses(config.getRecipientOverride()));
      apiMessage = String.format("Request sent to recipient override, %s.", config.getRecipientOverride());
    } else {
      // This IS a "production" request.
      sendEmailRequest.setDestination(new Destination().withToAddresses(action.getToAddress()));
    }

    Content subject = new Content().withCharset("UTF-8").withData(action.getEmailSubject());
    sendEmailRequest.setMessage(new Message(subject, body));

    AWSCredentials awsCredentials = new BasicAWSCredentials(config.getAccessKeyId(), config.getSecretKey());
    new AmazonSimpleEmailServiceClient(awsCredentials).sendEmail(sendEmailRequest);

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


    if (StringUtils.isNotBlank(reasonNotPermitted)) {
      return apiRequest.denyRequest(reasonNotPermitted);
    }

    String apiMessage = null;
    AwsEmailConfig config = apiClient.getAwsEmailConfig();

    Body body = new Body();
    if (StringUtils.isBlank(action.getHtmlContent())) {
      body.withText(new Content().withCharset("UTF-8").withData("-no message-"));
    } else {
      body.withHtml(new Content().withCharset("UTF-8").withData(action.getHtmlContent()));
    }

    SendEmailRequest sendEmailRequest = new SendEmailRequest();
    sendEmailRequest.withSource(action.getFromAddress());
    sendEmailRequest.withReturnPath(action.getFromAddress());
    sendEmailRequest.withReplyToAddresses(action.getFromAddress());

    if (StringUtils.isNotBlank(config.getRecipientOverride())) {
      // This is NOT a "production" request.
      sendEmailRequest.setDestination(new Destination().withToAddresses(config.getRecipientOverride()));
      apiMessage = String.format("Request sent to recipient override, %s.", config.getRecipientOverride());
    } else {
      // This IS a "production" request.
      sendEmailRequest.setDestination(new Destination().withToAddresses(action.getToAddress()));
    }

    Content subject = new Content().withCharset("UTF-8").withData(action.getEmailSubject());
    sendEmailRequest.setMessage(new Message(subject, body));

    AWSCredentials awsCredentials = new BasicAWSCredentials(config.getAccessKeyId(), config.getSecretKey());
    new AmazonSimpleEmailServiceClient(awsCredentials).sendEmail(sendEmailRequest);

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

    if (StringUtils.isNotBlank(reasonNotPermitted)) {
      return apiRequest.denyRequest(reasonNotPermitted);
    }

    String apiMessage = null;
    AwsEmailConfig config = apiClient.getAwsEmailConfig();

    SendEmailRequest sendEmailRequest = new SendEmailRequest();
    sendEmailRequest.withSource(action.getFromAddress());
    sendEmailRequest.withReturnPath(action.getFromAddress());
    sendEmailRequest.withReplyToAddresses(action.getFromAddress());

    if (StringUtils.isNotBlank(config.getRecipientOverride())) {
      // This is NOT a "production" request.
      sendEmailRequest.setDestination(new Destination().withToAddresses(config.getRecipientOverride()));
      apiMessage = String.format("Request sent to recipient override, %s.", config.getRecipientOverride());
    } else {
      // This IS a "production" request.
      sendEmailRequest.setDestination(new Destination().withToAddresses(action.getToAddress()));
    }

    Content subject = new Content().withCharset("UTF-8").withData("");

    Body body = new Body();
    body.withText(new Content().withCharset("UTF-8").withData(action.getMessage()));

    sendEmailRequest.setMessage(new Message(subject, body));

    AWSCredentials awsCredentials = new BasicAWSCredentials(config.getAccessKeyId(), config.getSecretKey());
    new AmazonSimpleEmailServiceClient(awsCredentials).sendEmail(sendEmailRequest);

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

TOP

Related Classes of com.cosmicpush.app.domain.clients.config.AwsEmailConfig

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.