Example usage for com.amazonaws.services.simpleemail.model SendEmailResult toString

List of usage examples for com.amazonaws.services.simpleemail.model SendEmailResult toString

Introduction

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

Prototype

@Override
public String toString() 

Source Link

Document

Returns a string representation of this object.

Usage

From source file:com.hiveTown.util.AmazonSESUtil.java

License:Open Source License

public boolean sendEmail(String[] toEmail, String strBody, String strSubject, String fromAddress,
        String replyToAddress) throws IOException {

    // Construct an object to contain the recipient address.
    Destination destination = new Destination().withToAddresses(toEmail);

    // Create the subject and body of the message.
    Content subject = new Content().withData(strSubject);
    Content textBody = new Content().withData(strBody);
    Body body = new Body().withHtml(textBody);

    // Create a message with the specified subject and body.
    Message message = new Message().withSubject(subject).withBody(body);

    // Assemble the email.
    SendEmailRequest request = new SendEmailRequest().withSource(fromAddress).withDestination(destination)
            .withMessage(message).withReplyToAddresses(replyToAddress);
    boolean isEmailSent = false;
    try {/*ww w . j a va 2 s.c  o m*/
        // Send the email.
        SendEmailResult r = this.getClient().sendEmail(request);
        LOGGER.info(r.toString());
        isEmailSent = true;

    } catch (Exception ex) {
        LOGGER.error(ex.toString());
    }
    return isEmailSent;
}