use of com.cribbstechnologies.clients.mandrill.model.response.message.SendMessageResponse in project Java-Mandrill-Wrapper by cribbstechnologies.
the class MandrillMessagesRequest method sendMessage.
/**
* Send a new transactional message through Mandrill
*
* @param messageRequest
* a populated @see com.cribstechnologies.clients.mandrill.model.MandrillMessageRequest
* @throws RequestFailedException
*/
public SendMessageResponse sendMessage(MandrillMessageRequest messageRequest) throws RequestFailedException {
SendMessageResponse response = new SendMessageResponse();
response.setList(((BaseMandrillAnonymousListResponse<MessageResponse>) request.postRequest(messageRequest, ServiceMethods.Messages.SEND, SendMessageResponse.class, messageResponseListReference)).getList());
return response;
}
use of com.cribbstechnologies.clients.mandrill.model.response.message.SendMessageResponse in project Java-Mandrill-Wrapper by cribbstechnologies.
the class MandrillMessagesRequest method sendTemplatedMessage.
public SendMessageResponse sendTemplatedMessage(MandrillTemplatedMessageRequest templateMessage) throws RequestFailedException {
SendMessageResponse response = new SendMessageResponse();
response.setList(((BaseMandrillAnonymousListResponse<MessageResponse>) request.postRequest(templateMessage, ServiceMethods.Messages.SEND_TEMPLATE, SendMessageResponse.class, messageResponseListReference)).getList());
return response;
}
use of com.cribbstechnologies.clients.mandrill.model.response.message.SendMessageResponse 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());
}
}
Aggregations