use of com.amazonaws.services.simpleemail.model.SendEmailRequest in project camel by apache.
the class SesComponentTest method sendMessageUsingMessageHeaders.
@Test
public void sendMessageUsingMessageHeaders() throws Exception {
Exchange exchange = template.send("direct:start", new Processor() {
public void process(Exchange exchange) throws Exception {
exchange.getIn().setBody("This is my message text.");
exchange.getIn().setHeader(SesConstants.FROM, "anotherFrom@example.com");
exchange.getIn().setHeader(SesConstants.TO, Arrays.asList("anotherTo1@example.com", "anotherTo2@example.com"));
exchange.getIn().setHeader(SesConstants.RETURN_PATH, "anotherBounce@example.com");
exchange.getIn().setHeader(SesConstants.REPLY_TO_ADDRESSES, Arrays.asList("anotherReplyTo1@example.com", "anotherReplyTo2@example.com"));
exchange.getIn().setHeader(SesConstants.SUBJECT, "anotherSubject");
}
});
assertEquals("1", exchange.getIn().getHeader(SesConstants.MESSAGE_ID));
SendEmailRequest sendEmailRequest = sesClient.getSendEmailRequest();
assertEquals("anotherFrom@example.com", sendEmailRequest.getSource());
assertEquals(2, getTo(sendEmailRequest).size());
assertTrue(getTo(sendEmailRequest).contains("anotherTo1@example.com"));
assertTrue(getTo(sendEmailRequest).contains("anotherTo2@example.com"));
assertEquals("anotherBounce@example.com", sendEmailRequest.getReturnPath());
assertEquals(2, sendEmailRequest.getReplyToAddresses().size());
assertTrue(sendEmailRequest.getReplyToAddresses().contains("anotherReplyTo1@example.com"));
assertTrue(sendEmailRequest.getReplyToAddresses().contains("anotherReplyTo2@example.com"));
assertEquals("anotherSubject", getSubject(sendEmailRequest));
assertEquals("This is my message text.", getBody(sendEmailRequest));
}
use of com.amazonaws.services.simpleemail.model.SendEmailRequest in project camel by apache.
the class SesComponentTest method sendInOnlyMessageUsingUrlOptions.
@Test
public void sendInOnlyMessageUsingUrlOptions() throws Exception {
Exchange exchange = template.send("direct:start", new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
exchange.getIn().setBody("This is my message text.");
}
});
assertEquals("1", exchange.getIn().getHeader(SesConstants.MESSAGE_ID));
SendEmailRequest sendEmailRequest = sesClient.getSendEmailRequest();
assertEquals("from@example.com", sendEmailRequest.getSource());
assertEquals(2, getTo(sendEmailRequest).size());
assertTrue(getTo(sendEmailRequest).contains("to1@example.com"));
assertTrue(getTo(sendEmailRequest).contains("to2@example.com"));
assertEquals("bounce@example.com", sendEmailRequest.getReturnPath());
assertEquals(2, sendEmailRequest.getReplyToAddresses().size());
assertTrue(sendEmailRequest.getReplyToAddresses().contains("replyTo1@example.com"));
assertTrue(sendEmailRequest.getReplyToAddresses().contains("replyTo2@example.com"));
assertEquals("Subject", getSubject(sendEmailRequest));
assertEquals("This is my message text.", getBody(sendEmailRequest));
}
Aggregations