Send a new transactional message through Mandrill.
* @param m The information on the message to send - * @param async Enable a background sending mode that is optimized - * for bulk sending. In async mode, messages/send will immediately - * return a status of 'queued' for every recipient. To handle - * rejections when sending in async mode, set up a webhook for the - * 'reject' event. Defaults to false for messages with no more than - * 10 recipients; messages with more than 10 recipients are always + * @param async Enable a background sending mode that is optimized + * for bulk sending. In async mode, messages/send will immediately + * return a status of 'queued' for every recipient. To handle + * rejections when sending in async mode, set up a webhook for the + * 'reject' event. Defaults to false for messages with no more than + * 10 recipients; messages with more than 10 recipients are always * sent asynchronously, regardless of the value of async. - * @return An array of {@link MandrillMessageStatus} objects, one for - * each recipient containing the key 'email' - * ({@link MandrillMessageStatus#getEmail()}) and - * {@link MandrillMessageStatus#getStatus()} as either 'sent', + * @return An array of {@link MandrillMessageStatus} objects, one for + * each recipient containing the key 'email' + * ({@link MandrillMessageStatus#getEmail()}) and + * {@link MandrillMessageStatus#getStatus()} as either 'sent', * 'queued', or 'rejected'. * @throws MandrillApiError Mandrill API Error * @throws IOException IO Error */ - public MandrillMessageStatus[] send(final MandrillMessage m, + public MandrillMessageStatus[] send(final MandrillMessage m, final Boolean async) throws MandrillApiError, IOException { - + return send(m, async, null, null); - + } - + /** *Send a new transactional message through Mandrill.
* @param m The information on the message to send - * @param async Enable a background sending mode that is optimized - * for bulk sending. In async mode, messages/send will immediately - * return a status of 'queued' for every recipient. To handle - * rejections when sending in async mode, set up a webhook for the - * 'reject' event. Defaults to false for messages with no more than - * 10 recipients; messages with more than 10 recipients are always + * @param async Enable a background sending mode that is optimized + * for bulk sending. In async mode, messages/send will immediately + * return a status of 'queued' for every recipient. To handle + * rejections when sending in async mode, set up a webhook for the + * 'reject' event. Defaults to false for messages with no more than + * 10 recipients; messages with more than 10 recipients are always * sent asynchronously, regardless of the value of async. - * @param ipPool The name of the dedicated ip pool that should be - * used to send the message. If you do not have any dedicated IPs, - * this parameter has no effect. If you specify a pool that does - * not exist, your default pool will be used instead. Set to + * @param ipPool The name of the dedicated ip pool that should be + * used to send the message. If you do not have any dedicated IPs, + * this parameter has no effect. If you specify a pool that does + * not exist, your default pool will be used instead. Set to *null to ignore this parameter.
- * @param sendAt When this message should be sent. If you specify a
- * time in the past, the message will be sent immediately. An
- * additional fee applies for scheduled email, and this feature is
- * only available to accounts with a positive balance. Set to
+ * @param sendAt When this message should be sent. If you specify a
+ * time in the past, the message will be sent immediately. An
+ * additional fee applies for scheduled email, and this feature is
+ * only available to accounts with a positive balance. Set to
* null to ignore this parameter.
- * @return An array of {@link MandrillMessageStatus} objects, one for
- * each recipient containing the key 'email'
- * ({@link MandrillMessageStatus#getEmail()}) and
- * {@link MandrillMessageStatus#getStatus()} as either 'sent',
+ * @return An array of {@link MandrillMessageStatus} objects, one for
+ * each recipient containing the key 'email'
+ * ({@link MandrillMessageStatus#getEmail()}) and
+ * {@link MandrillMessageStatus#getStatus()} as either 'sent',
* 'queued', or 'rejected'.
* @throws MandrillApiError Mandrill API Error
* @throws IOException IO Error
*/
- public MandrillMessageStatus[] send(final MandrillMessage m,
- final Boolean async, final String ipPool, final Date sendAt)
+ public MandrillMessageStatus[] send(final MandrillMessage m,
+ final Boolean async, final String ipPool, final Date sendAt)
throws MandrillApiError, IOException {
-
+
final HashMapSend a new transactional message through Mandrill + *
Send a new transactional message through Mandrill * using a template.
- * @param templateName The name of a template that exists + * @param templateName The name of a template that exists * in the user's account; Required. - * @param templateContent A map of template content to send. - * Each entry in the map should have the name of the content + * @param templateContent A map of template content to send. + * Each entry in the map should have the name of the content * block to set the content for, corresponding to an mc:edit block, * and the actual content to put into the block. May be null. - * @param m The other information on the message to send – - * same as {@link #send(MandrillMessage, Boolean)}, but without + * @param m The other information on the message to send – + * same as {@link #send(MandrillMessage, Boolean)}, but without * the html content. - * @param async Enable a background sending mode that is optimized - * for bulk sending. In async mode, messages/send will immediately - * return a status of 'queued' for every recipient. To handle - * rejections when sending in async mode, set up a webhook for the - * 'reject' event. Defaults to false for messages with no more than - * 10 recipients; messages with more than 10 recipients are always + * @param async Enable a background sending mode that is optimized + * for bulk sending. In async mode, messages/send will immediately + * return a status of 'queued' for every recipient. To handle + * rejections when sending in async mode, set up a webhook for the + * 'reject' event. Defaults to false for messages with no more than + * 10 recipients; messages with more than 10 recipients are always * sent asynchronously, regardless of the value of async. - * @return An array of {@link MandrillMessageStatus} objects, one for - * each recipient containing the key 'email' - * ({@link MandrillMessageStatus#getEmail()}) and - * {@link MandrillMessageStatus#getStatus()} as either 'sent', + * @return An array of {@link MandrillMessageStatus} objects, one for + * each recipient containing the key 'email' + * ({@link MandrillMessageStatus#getEmail()}) and + * {@link MandrillMessageStatus#getStatus()} as either 'sent', * 'queued', or 'rejected'. * @throws MandrillApiError Mandrill API Error * @throws IOException IO Error */ public MandrillMessageStatus[] sendTemplate( - final String templateName, final MapSend a new transactional message through Mandrill + *
Send a new transactional message through Mandrill * using a template.
- * @param templateName The name of a template that exists + * @param templateName The name of a template that exists * in the user's account; Required. - * @param templateContent A map of template content to send. - * Each entry in the map should have the name of the content + * @param templateContent A map of template content to send. + * Each entry in the map should have the name of the content * block to set the content for, corresponding to an mc:edit block, * and the actual content to put into the block. May be null. - * @param m The other information on the message to send – - * same as {@link #send(MandrillMessage, Boolean)}, but without + * @param m The other information on the message to send – + * same as {@link #send(MandrillMessage, Boolean)}, but without * the html content. - * @param async Enable a background sending mode that is optimized - * for bulk sending. In async mode, messages/send will immediately - * return a status of 'queued' for every recipient. To handle - * rejections when sending in async mode, set up a webhook for the - * 'reject' event. Defaults to false for messages with no more than - * 10 recipients; messages with more than 10 recipients are always + * @param async Enable a background sending mode that is optimized + * for bulk sending. In async mode, messages/send will immediately + * return a status of 'queued' for every recipient. To handle + * rejections when sending in async mode, set up a webhook for the + * 'reject' event. Defaults to false for messages with no more than + * 10 recipients; messages with more than 10 recipients are always * sent asynchronously, regardless of the value of async. - * @param ipPool The name of the dedicated ip pool that should be - * used to send the message. If you do not have any dedicated IPs, - * this parameter has no effect. If you specify a pool that does - * not exist, your default pool will be used instead. Set to + * @param ipPool The name of the dedicated ip pool that should be + * used to send the message. If you do not have any dedicated IPs, + * this parameter has no effect. If you specify a pool that does + * not exist, your default pool will be used instead. Set to *null to ignore this parameter.
- * @param sendAt When this message should be sent. If you specify a
- * time in the past, the message will be sent immediately. An
- * additional fee applies for scheduled email, and this feature is
- * only available to accounts with a positive balance. Set to
+ * @param sendAt When this message should be sent. If you specify a
+ * time in the past, the message will be sent immediately. An
+ * additional fee applies for scheduled email, and this feature is
+ * only available to accounts with a positive balance. Set to
* null to ignore this parameter.
- * @return An array of {@link MandrillMessageStatus} objects, one for
- * each recipient containing the key 'email'
- * ({@link MandrillMessageStatus#getEmail()}) and
- * {@link MandrillMessageStatus#getStatus()} as either 'sent',
+ * @return An array of {@link MandrillMessageStatus} objects, one for
+ * each recipient containing the key 'email'
+ * ({@link MandrillMessageStatus#getEmail()}) and
+ * {@link MandrillMessageStatus#getStatus()} as either 'sent',
* 'queued', or 'rejected'.
* @throws MandrillApiError Mandrill API Error
* @throws IOException IO Error
*/
public MandrillMessageStatus[] sendTemplate(
- final String templateName, final MapSearch the content of recently sent messages and + *
Search the content of recently sent messages and * optionally narrow by date range, tags and senders.
* @param search Search parameters for message searching. - * @return An array of {@link MandrillMessageInfo} objects + * @return An array of {@link MandrillMessageInfo} objects * containing found messages for the performed search. * @throws MandrillApiError Mandrill API Error * @throws IOException IO Error */ public MandrillMessageInfo[] search( - final MandrillSearchMessageParams search) + final MandrillSearchMessageParams search) throws MandrillApiError, IOException { - + final HashMapSearch the content of recently sent messages and return + *
Search the content of recently sent messages and return * the aggregated hourly stats for matching messages.
* @param search Search parameters for message searching. - * @return An array of {@link MandrillTimeSeries} objects + * @return An array of {@link MandrillTimeSeries} objects * containing aggregated hourly stats for the matching messages. * @throws MandrillApiError Mandrill API Error * @throws IOException IO Error */ public MandrillTimeSeries[] searchTimeSeries( - final MandrillSearchMessageParams search) + final MandrillSearchMessageParams search) throws MandrillApiError, IOException { - + final HashMapGet the information for a single recently sent message.
- * @param id The unique id of the message to get – passed as + * @param id The unique id of the message to get – passed as * the '_id' field in webhooks, send calls, or search calls. * @return The information for the message. * @throws MandrillApiError Mandrill API Error * @throws IOException IO Error */ - public MandrillMessageInfo info(final String id) + public MandrillMessageInfo info(final String id) throws MandrillApiError, IOException { - + final HashMapParse the full MIME document for an email message, - * returning the content of the message broken into + *
Parse the full MIME document for an email message, + * returning the content of the message broken into * its constituent pieces.
* @param rawMessage The full MIME document of an email message. * @return The parsed message as a {@link MandrillMessage}. * @throws MandrillApiError Mandrill API Error * @throws IOException IO Error */ - public MandrillMessage parse(final String rawMessage) + public MandrillMessage parse(final String rawMessage) throws MandrillApiError, IOException { - + final HashMapQueries your scheduled emails by sender or recipient, or both.
* @param to An optional recipient address to restrict results to. @@ -381,59 +381,59 @@ public MandrillMessageStatus[] sendRaw(final String fromEmail, * @throws MandrillApiError Mandrill API Error * @throws IOException IO Error */ - public MandrillScheduledMessageInfo[] listScheduled(final String to) + public MandrillScheduledMessageInfo[] listScheduled(final String to) throws MandrillApiError, IOException { - + final HashMapCancels a scheduled email.
- * @param id A scheduled email id, as returned by any of + * @param id A scheduled email id, as returned by any of * the messages/send calls or messages/list-scheduled. * @return Information about the scheduled email that was cancelled. * @throws MandrillApiError Mandrill API Error * @throws IOException IO Error */ - public MandrillScheduledMessageInfo cancelScheduled(final String id) + public MandrillScheduledMessageInfo cancelScheduled(final String id) throws MandrillApiError, IOException { - + final HashMapReschedules a scheduled email.
- * @param id A scheduled email id, as returned by any of + * @param id A scheduled email id, as returned by any of * the messages/send calls or messages/list-scheduled. - * @param send_at The new UTC timestamp when the message should - * sent. Mandrill can't time travel, so if you specify a time in + * @param send_at The new UTC timestamp when the message should + * sent. Mandrill can't time travel, so if you specify a time in * past the message will be sent immediately. * @return Information about the scheduled email that was cancelled. * @throws MandrillApiError Mandrill API Error * @throws IOException IO Error */ - public MandrillScheduledMessageInfo reschedule(final String id, + public MandrillScheduledMessageInfo reschedule(final String id, final Date send_at) throws MandrillApiError, IOException { - + final HashMapGet the list of all webhooks defined for this account.
* @return An array of {@link MandrillWebhook} objects. * @throws MandrillApiError Mandrill API Error * @throws IOException IO Error */ - public MandrillWebhook[] list() throws MandrillApiError, + public MandrillWebhook[] list() throws MandrillApiError, IOException { - + return MandrillUtil.query( - rootUrl+ "webhooks/list.json", - MandrillUtil.paramsWithKey(key), + rootUrl+ "webhooks/list.json", + MandrillUtil.paramsWithKey(key), MandrillWebhook[].class); - + } - + /** *Add a new webhook.
* @param url The URL to POST batches of events. - * @param event An optional event that will be posted + * @param event An optional event that will be posted * to the webhook. You can use - * {@link MandrillWebhook#SEND}, {@link MandrillWebhook#HARD_BOUNCE}, - * {@link MandrillWebhook#SOFT_BOUNCE}, {@link MandrillWebhook#OPEN}, - * {@link MandrillWebhook#CLICK}, {@link MandrillWebhook#SPAM}, - * {@link MandrillWebhook#UNSUB} and {@link MandrillWebhook#REJECT} + * {@link MandrillWebhook#SEND}, {@link MandrillWebhook#HARD_BOUNCE}, + * {@link MandrillWebhook#SOFT_BOUNCE}, {@link MandrillWebhook#OPEN}, + * {@link MandrillWebhook#CLICK}, {@link MandrillWebhook#SPAM}, + * {@link MandrillWebhook#UNSUB} and {@link MandrillWebhook#REJECT} * as valid events. * @return A {@link MandrillWebhook} object with info about the new webhook. * @throws MandrillApiError Mandrill API Error * @throws IOException IO Error */ - public MandrillWebhook add(final String url, final String event) + public MandrillWebhook add(final String url, final String event) throws MandrillApiError, IOException { - - final ArrayListAdd a new webhook.
* @param url The URL to POST batches of events. - * @param events An optional collection of events + * @param events An optional collection of events * that will be posted to the webhook. You can use - * {@link MandrillWebhook#SEND}, {@link MandrillWebhook#HARD_BOUNCE}, - * {@link MandrillWebhook#SOFT_BOUNCE}, {@link MandrillWebhook#OPEN}, - * {@link MandrillWebhook#CLICK}, {@link MandrillWebhook#SPAM}, - * {@link MandrillWebhook#UNSUB} and {@link MandrillWebhook#REJECT} + * {@link MandrillWebhook#SEND}, {@link MandrillWebhook#HARD_BOUNCE}, + * {@link MandrillWebhook#SOFT_BOUNCE}, {@link MandrillWebhook#OPEN}, + * {@link MandrillWebhook#CLICK}, {@link MandrillWebhook#SPAM}, + * {@link MandrillWebhook#UNSUB} and {@link MandrillWebhook#REJECT} * as valid events. * @return A {@link MandrillWebhook} object with info about the new webhook. * @throws MandrillApiError Mandrill API Error * @throws IOException IO Error */ - public MandrillWebhook add(final String url, - final CollectionAdd a new webhook.
* @param url The URL to POST batches of events. * @param description An optional description of the webhook. - * @param events An optional array of events that will + * @param events An optional array of events that will * be posted to the webhook. You can use - * {@link MandrillWebhook#SEND}, {@link MandrillWebhook#HARD_BOUNCE}, - * {@link MandrillWebhook#SOFT_BOUNCE}, {@link MandrillWebhook#OPEN}, - * {@link MandrillWebhook#CLICK}, {@link MandrillWebhook#SPAM}, - * {@link MandrillWebhook#UNSUB} and {@link MandrillWebhook#REJECT} + * {@link MandrillWebhook#SEND}, {@link MandrillWebhook#HARD_BOUNCE}, + * {@link MandrillWebhook#SOFT_BOUNCE}, {@link MandrillWebhook#OPEN}, + * {@link MandrillWebhook#CLICK}, {@link MandrillWebhook#SPAM}, + * {@link MandrillWebhook#UNSUB} and {@link MandrillWebhook#REJECT} * as valid events. * @return A {@link MandrillWebhook} object with info about the new webhook. * @throws MandrillApiError Mandrill API Error * @throws IOException IO Error */ - public MandrillWebhook add(final String url, final String description, + public MandrillWebhook add(final String url, final String description, final CollectionGet the data about an existing webhook.
* @param id The unique identifier of a webhook belonging to this account. @@ -124,43 +124,43 @@ public MandrillWebhook add(final String url, final String description, * @throws MandrillApiError Mandrill API Error * @throws IOException IO Error */ - public MandrillWebhook info(final Integer id) + public MandrillWebhook info(final Integer id) throws MandrillApiError, IOException { - + final HashMapUpdate an existing webhook.
* @param id The unique identifier of a webhook belonging to this account. * @param url The URL to POST batches of events. * @param event An optional events that will be posted to the webhook. You can use - * {@link MandrillWebhook#SEND}, {@link MandrillWebhook#HARD_BOUNCE}, - * {@link MandrillWebhook#SOFT_BOUNCE}, {@link MandrillWebhook#OPEN}, - * {@link MandrillWebhook#CLICK}, {@link MandrillWebhook#SPAM}, - * {@link MandrillWebhook#UNSUB} and {@link MandrillWebhook#REJECT} + * {@link MandrillWebhook#SEND}, {@link MandrillWebhook#HARD_BOUNCE}, + * {@link MandrillWebhook#SOFT_BOUNCE}, {@link MandrillWebhook#OPEN}, + * {@link MandrillWebhook#CLICK}, {@link MandrillWebhook#SPAM}, + * {@link MandrillWebhook#UNSUB} and {@link MandrillWebhook#REJECT} * as valid events. * @return A {@link MandrillWebhook} object with info about the webhook. * @throws MandrillApiError Mandrill API Error * @throws IOException IO Error */ - public MandrillWebhook update(final Integer id, - final String url, final String event) + public MandrillWebhook update(final Integer id, + final String url, final String event) throws MandrillApiError, IOException { - - final ArrayListUpdate an existing webhook.
- * @param id The unique identifier of a webhook + * @param id The unique identifier of a webhook * belonging to this account. * @param url The URL to POST batches of events. * @param events An optional collection of events that will be posted to the webhook. @@ -168,14 +168,14 @@ public MandrillWebhook update(final Integer id, * @throws MandrillApiError Mandrill API Error * @throws IOException IO Error */ - public MandrillWebhook update(final Integer id, - final String url, final CollectionUpdate an existing webhook.
* @param id The unique identifier of a webhook belonging to this account. @@ -186,20 +186,20 @@ public MandrillWebhook update(final Integer id, * @throws MandrillApiError Mandrill API Error * @throws IOException IO Error */ - public MandrillWebhook update(final Integer id, final String url, - final String description, final CollectionDelete an existing webhook.
* @param id The unique identifier of a webhook belonging to this account. @@ -207,13 +207,13 @@ public MandrillWebhook update(final Integer id, final String url, * @throws MandrillApiError Mandrill API Error * @throws IOException IO Error */ - public MandrillWebhook delete(final Integer id) + public MandrillWebhook delete(final Integer id) throws MandrillApiError, IOException { - + final HashMapChecks weather the response-status is as-expected + *
Checks weather the response-status is as-expected * for this request.
* @param httpResponseStatus The HTTP response status * @returntrue if the response status is as expected,
* false otherwise.
*/
- public boolean validateResponseStatus(int httpResponseStatus);
-
+ boolean validateResponseStatus(int httpResponseStatus);
+
/**
* Parses the content/data of this request's response into
* a desired format {@link V}.
@@ -46,6 +44,6 @@ public interface RequestModel A single recipient's information. A single supported content object for a message. This
* can be a embedded image or an attachment. A per-recipient merge variable. A single global merge variable. Metadata for a single recipient If you want to run your own tests, either provide a file
- * 'myapikey.txt' on your classpath, or simply change this
+ * 'myapikey.txt' on your classpath, or simply change this
* method to return your hard-coded string. If you provide a file, this file should ONLY contain your
- * Mandrill api key, as plain text in ONLY ONE line. This also
+ * Mandrill api key, as plain text in ONLY ONE line. This also
* allows you to keep your api key secret since 'myapikey.txt'
- * is mentioned in .gitignore and will not be pushed to git!
Tests for the messages api implementations.
@@ -51,7 +46,7 @@ public final void testSend02() throws IOException, MandrillApiError { Recipient to = new Recipient(); to.setEmail(mailToAddress()); to.setType(Type.TO); - List