Example usage for com.amazonaws.services.simpleemail AmazonSimpleEmailService sendEmail

List of usage examples for com.amazonaws.services.simpleemail AmazonSimpleEmailService sendEmail

Introduction

In this page you can find the example usage for com.amazonaws.services.simpleemail AmazonSimpleEmailService sendEmail.

Prototype

SendEmailResult sendEmail(SendEmailRequest sendEmailRequest);

Source Link

Document

Composes an email message and immediately queues it for sending.

Usage

From source file:spikes.email.AmazonSimpleEmailServiceSpike.java

License:Open Source License

public static void main(String[] args) throws IOException {

    PropertiesCredentials credentials = new PropertiesCredentials(
            AmazonSimpleEmailServiceSpike.class.getResourceAsStream("AwsCredentials.properties"));

    AmazonSimpleEmailService service = new AmazonSimpleEmailServiceClient(credentials);

    verifyAddressIfNecessary(service, FROM);

    Destination destination = new Destination(Arrays.asList(TO));
    Content subject = new Content(SUBJECT);
    Body body = new Body().withHtml(new Content(BODY));
    Message message = new Message(subject, body);
    service.sendEmail(new SendEmailRequest(from(), destination, message));

    System.exit(0);/*from  ww  w . ja  va  2s  . c  o  m*/

}