Example usage for com.amazonaws.services.simpleemail.model Destination withToAddresses

List of usage examples for com.amazonaws.services.simpleemail.model Destination withToAddresses

Introduction

In this page you can find the example usage for com.amazonaws.services.simpleemail.model Destination withToAddresses.

Prototype


public Destination withToAddresses(java.util.Collection<String> toAddresses) 

Source Link

Document

The recipients to place on the To: line of the message.

Usage

From source file:org.springframework.cloud.aws.mail.simplemail.SimpleEmailServiceMailSender.java

License:Apache License

private SendEmailRequest prepareMessage(SimpleMailMessage simpleMailMessage) {
    Destination destination = new Destination();
    destination.withToAddresses(simpleMailMessage.getTo());

    if (simpleMailMessage.getCc() != null) {
        destination.withCcAddresses(simpleMailMessage.getCc());
    }//  www.  j  a va2 s  . c o m

    if (simpleMailMessage.getBcc() != null) {
        destination.withBccAddresses(simpleMailMessage.getBcc());
    }

    Content subject = new Content(simpleMailMessage.getSubject());
    Body body = new Body(new Content(simpleMailMessage.getText()));

    SendEmailRequest emailRequest = new SendEmailRequest(simpleMailMessage.getFrom(), destination,
            new Message(subject, body));

    if (StringUtils.hasText(simpleMailMessage.getReplyTo())) {
        emailRequest.withReplyToAddresses(simpleMailMessage.getReplyTo());
    }

    return emailRequest;
}