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

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

Introduction

In this page you can find the example usage for com.amazonaws.services.simpleemail.model SendRawEmailResult 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 String sendRawEmail(String[] toEmail, String fromAddress, MimeMessage mimeMessage) {
    try {/*from  w w w. ja v  a  2  s.c om*/
        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        mimeMessage.writeTo(outputStream);
        RawMessage rawMessage = new RawMessage(ByteBuffer.wrap(outputStream.toByteArray()));

        // Assemble the email.
        SendRawEmailRequest request = new SendRawEmailRequest().withSource(fromAddress)
                .withDestinations(toEmail).withRawMessage(rawMessage);

        // Send the email.
        SendRawEmailResult r = this.getClient().sendRawEmail(request);

        LOGGER.info(r.toString());
        return r.getMessageId();

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