use of com.cribbstechnologies.clients.mandrill.exception.RequestFailedException in project Java-Mandrill-Wrapper by cribbstechnologies.
the class MessagesTest method testSendMessage.
@Test
public void testSendMessage() {
MandrillMessageRequest mmr = new MandrillMessageRequest();
MandrillHtmlMessage message = new MandrillHtmlMessage();
Map<String, String> headers = new HashMap<String, String>();
message.setFrom_email(props.getProperty("email.from"));
message.setFrom_name("Big Jimmy");
message.setHeaders(headers);
message.setHtml("<html><body><h1>Oh snap!</h1>Guess what I saw?<a href=\"http://www.google.com\">google</a></body></html>");
message.setSubject("This is the subject");
MandrillRecipient[] recipients = new MandrillRecipient[] { new MandrillRecipient(props.getProperty("email.to.name1"), props.getProperty("email.to.address1")), new MandrillRecipient(props.getProperty("email.to.name2"), props.getProperty("email.to.address2")) };
message.setTo(recipients);
message.setTrack_clicks(true);
message.setTrack_opens(true);
String[] tags = new String[] { "tag1", "tag2", "tag3" };
message.setTags(tags);
mmr.setMessage(message);
try {
SendMessageResponse response = messagesRequest.sendMessage(mmr);
} catch (RequestFailedException e) {
e.printStackTrace();
fail(e.getMessage());
}
}
use of com.cribbstechnologies.clients.mandrill.exception.RequestFailedException in project Java-Mandrill-Wrapper by cribbstechnologies.
the class TagsTest method testGetTimeSeries.
@Test
public void testGetTimeSeries() {
MandrillRequestWithTag request = new MandrillRequestWithTag();
request.setTag("tag1");
try {
TagSeriesResponse response = tagsRequest.getTimeSeries(request);
} catch (RequestFailedException e) {
e.printStackTrace();
fail(e.getMessage());
}
}
Aggregations