Overview

Namespaces

  • None
  • PHP

Classes

  • Mandrill
  • Mandrill_Exports
  • Mandrill_Inbound
  • Mandrill_Internal
  • Mandrill_Ips
  • Mandrill_Messages
  • Mandrill_Metadata
  • Mandrill_Rejects
  • Mandrill_Senders
  • Mandrill_Subaccounts
  • Mandrill_Tags
  • Mandrill_Templates
  • Mandrill_Urls
  • Mandrill_Users
  • Mandrill_Webhooks
  • Mandrill_Whitelists

Exceptions

  • Mandrill_Error
  • Mandrill_HttpError
  • Mandrill_Invalid_CustomDNS
  • Mandrill_Invalid_CustomDNSPending
  • Mandrill_Invalid_DeleteDefaultPool
  • Mandrill_Invalid_DeleteNonEmptyPool
  • Mandrill_Invalid_EmptyDefaultPool
  • Mandrill_Invalid_Key
  • Mandrill_Invalid_Reject
  • Mandrill_Invalid_Tag_Name
  • Mandrill_Invalid_Template
  • Mandrill_IP_ProvisionLimit
  • Mandrill_Metadata_FieldLimit
  • Mandrill_NoSendingHistory
  • Mandrill_PaymentRequired
  • Mandrill_PoorReputation
  • Mandrill_ServiceUnavailable
  • Mandrill_Unknown_Export
  • Mandrill_Unknown_InboundDomain
  • Mandrill_Unknown_InboundRoute
  • Mandrill_Unknown_IP
  • Mandrill_Unknown_Message
  • Mandrill_Unknown_MetadataField
  • Mandrill_Unknown_Pool
  • Mandrill_Unknown_Sender
  • Mandrill_Unknown_Subaccount
  • Mandrill_Unknown_Template
  • Mandrill_Unknown_TrackingDomain
  • Mandrill_Unknown_Url
  • Mandrill_Unknown_Webhook
  • Mandrill_ValidationError
  • Overview
  • Namespace
  • Class
  • Tree
  1: <?php
  2: 
  3: class Mandrill_Messages {
  4:     public function __construct(Mandrill $master) {
  5:         $this->master = $master;
  6:     }
  7: 
  8:     /**
  9:      * Send a new transactional message through Mandrill
 10:      * @param struct $message the information on the message to send
 11:      *     - html string the full HTML content to be sent
 12:      *     - text string optional full text content to be sent
 13:      *     - subject string the message subject
 14:      *     - from_email string the sender email address.
 15:      *     - from_name string optional from name to be used
 16:      *     - to array an array of recipient information.
 17:      *         - to[] struct a single recipient's information.
 18:      *             - email string the email address of the recipient
 19:      *             - name string the optional display name to use for the recipient
 20:      *             - type string the header type to use for the recipient, defaults to "to" if not provided
 21:      *     - headers struct optional extra headers to add to the message (most headers are allowed)
 22:      *     - important boolean whether or not this message is important, and should be delivered ahead of non-important messages
 23:      *     - track_opens boolean whether or not to turn on open tracking for the message
 24:      *     - track_clicks boolean whether or not to turn on click tracking for the message
 25:      *     - auto_text boolean whether or not to automatically generate a text part for messages that are not given text
 26:      *     - auto_html boolean whether or not to automatically generate an HTML part for messages that are not given HTML
 27:      *     - inline_css boolean whether or not to automatically inline all CSS styles provided in the message HTML - only for HTML documents less than 256KB in size
 28:      *     - url_strip_qs boolean whether or not to strip the query string from URLs when aggregating tracked URL data
 29:      *     - preserve_recipients boolean whether or not to expose all recipients in to "To" header for each email
 30:      *     - view_content_link boolean set to false to remove content logging for sensitive emails
 31:      *     - bcc_address string an optional address to receive an exact copy of each recipient's email
 32:      *     - tracking_domain string a custom domain to use for tracking opens and clicks instead of mandrillapp.com
 33:      *     - signing_domain string a custom domain to use for SPF/DKIM signing instead of mandrill (for "via" or "on behalf of" in email clients)
 34:      *     - return_path_domain string a custom domain to use for the messages's return-path
 35:      *     - merge boolean whether to evaluate merge tags in the message. Will automatically be set to true if either merge_vars or global_merge_vars are provided.
 36:      *     - merge_language string the merge tag language to use when evaluating merge tags, either mailchimp or handlebars
 37:      *     - global_merge_vars array global merge variables to use for all recipients. You can override these per recipient.
 38:      *         - global_merge_vars[] struct a single global merge variable
 39:      *             - name string the global merge variable's name. Merge variable names are case-insensitive and may not start with _
 40:      *             - content mixed the global merge variable's content
 41:      *     - merge_vars array per-recipient merge variables, which override global merge variables with the same name.
 42:      *         - merge_vars[] struct per-recipient merge variables
 43:      *             - rcpt string the email address of the recipient that the merge variables should apply to
 44:      *             - vars array the recipient's merge variables
 45:      *                 - vars[] struct a single merge variable
 46:      *                     - name string the merge variable's name. Merge variable names are case-insensitive and may not start with _
 47:      *                     - content mixed the merge variable's content
 48:      *     - tags array an array of string to tag the message with.  Stats are accumulated using tags, though we only store the first 100 we see, so this should not be unique or change frequently.  Tags should be 50 characters or less.  Any tags starting with an underscore are reserved for internal use and will cause errors.
 49:      *         - tags[] string a single tag - must not start with an underscore
 50:      *     - subaccount string the unique id of a subaccount for this message - must already exist or will fail with an error
 51:      *     - google_analytics_domains array an array of strings indicating for which any matching URLs will automatically have Google Analytics parameters appended to their query string automatically.
 52:      *     - google_analytics_campaign array|string optional string indicating the value to set for the utm_campaign tracking parameter. If this isn't provided the email's from address will be used instead.
 53:      *     - metadata array metadata an associative array of user metadata. Mandrill will store this metadata and make it available for retrieval. In addition, you can select up to 10 metadata fields to index and make searchable using the Mandrill search api.
 54:      *     - recipient_metadata array Per-recipient metadata that will override the global values specified in the metadata parameter.
 55:      *         - recipient_metadata[] struct metadata for a single recipient
 56:      *             - rcpt string the email address of the recipient that the metadata is associated with
 57:      *             - values array an associated array containing the recipient's unique metadata. If a key exists in both the per-recipient metadata and the global metadata, the per-recipient metadata will be used.
 58:      *     - attachments array an array of supported attachments to add to the message
 59:      *         - attachments[] struct a single supported attachment
 60:      *             - type string the MIME type of the attachment
 61:      *             - name string the file name of the attachment
 62:      *             - content string the content of the attachment as a base64-encoded string
 63:      *     - images array an array of embedded images to add to the message
 64:      *         - images[] struct a single embedded image
 65:      *             - type string the MIME type of the image - must start with "image/"
 66:      *             - name string the Content ID of the image - use <img src="cid:THIS_VALUE"> to reference the image in your HTML content
 67:      *             - content string the content of the image as a base64-encoded string
 68:      * @param boolean $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.
 69:      * @param string $ip_pool 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.
 70:      * @param string $send_at when this message should be sent as a UTC timestamp in YYYY-MM-DD HH:MM:SS format. 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.
 71:      * @return array of structs for each recipient containing the key "email" with the email address, and details of the message status for that recipient
 72:      *     - return[] struct the sending results for a single recipient
 73:      *         - email string the email address of the recipient
 74:      *         - status string the sending status of the recipient - either "sent", "queued", "scheduled", "rejected", or "invalid"
 75:      *         - reject_reason string the reason for the rejection if the recipient status is "rejected" - one of "hard-bounce", "soft-bounce", "spam", "unsub", "custom", "invalid-sender", "invalid", "test-mode-limit", or "rule"
 76:      *         - _id string the message's unique id
 77:      */
 78:     public function send($message, $async=false, $ip_pool=null, $send_at=null) {
 79:         $_params = array("message" => $message, "async" => $async, "ip_pool" => $ip_pool, "send_at" => $send_at);
 80:         return $this->master->call('messages/send', $_params);
 81:     }
 82: 
 83:     /**
 84:      * Send a new transactional message through Mandrill using a template
 85:      * @param string $template_name the immutable name or slug of a template that exists in the user's account. For backwards-compatibility, the template name may also be used but the immutable slug is preferred.
 86:      * @param array $template_content an array of template content to send.  Each item in the array should be a struct with two keys - name: the name of the content block to set the content for, and content: the actual content to put into the block
 87:      *     - template_content[] struct the injection of a single piece of content into a single editable region
 88:      *         - name string the name of the mc:edit editable region to inject into
 89:      *         - content string the content to inject
 90:      * @param struct $message the other information on the message to send - same as /messages/send, but without the html content
 91:      *     - html string optional full HTML content to be sent if not in template
 92:      *     - text string optional full text content to be sent
 93:      *     - subject string the message subject
 94:      *     - from_email string the sender email address.
 95:      *     - from_name string optional from name to be used
 96:      *     - to array an array of recipient information.
 97:      *         - to[] struct a single recipient's information.
 98:      *             - email string the email address of the recipient
 99:      *             - name string the optional display name to use for the recipient
100:      *             - type string the header type to use for the recipient, defaults to "to" if not provided
101:      *     - headers struct optional extra headers to add to the message (most headers are allowed)
102:      *     - important boolean whether or not this message is important, and should be delivered ahead of non-important messages
103:      *     - track_opens boolean whether or not to turn on open tracking for the message
104:      *     - track_clicks boolean whether or not to turn on click tracking for the message
105:      *     - auto_text boolean whether or not to automatically generate a text part for messages that are not given text
106:      *     - auto_html boolean whether or not to automatically generate an HTML part for messages that are not given HTML
107:      *     - inline_css boolean whether or not to automatically inline all CSS styles provided in the message HTML - only for HTML documents less than 256KB in size
108:      *     - url_strip_qs boolean whether or not to strip the query string from URLs when aggregating tracked URL data
109:      *     - preserve_recipients boolean whether or not to expose all recipients in to "To" header for each email
110:      *     - view_content_link boolean set to false to remove content logging for sensitive emails
111:      *     - bcc_address string an optional address to receive an exact copy of each recipient's email
112:      *     - tracking_domain string a custom domain to use for tracking opens and clicks instead of mandrillapp.com
113:      *     - signing_domain string a custom domain to use for SPF/DKIM signing instead of mandrill (for "via" or "on behalf of" in email clients)
114:      *     - return_path_domain string a custom domain to use for the messages's return-path
115:      *     - merge boolean whether to evaluate merge tags in the message. Will automatically be set to true if either merge_vars or global_merge_vars are provided.
116:      *     - merge_language string the merge tag language to use when evaluating merge tags, either mailchimp or handlebars
117:      *     - global_merge_vars array global merge variables to use for all recipients. You can override these per recipient.
118:      *         - global_merge_vars[] struct a single global merge variable
119:      *             - name string the global merge variable's name. Merge variable names are case-insensitive and may not start with _
120:      *             - content mixed the global merge variable's content
121:      *     - merge_vars array per-recipient merge variables, which override global merge variables with the same name.
122:      *         - merge_vars[] struct per-recipient merge variables
123:      *             - rcpt string the email address of the recipient that the merge variables should apply to
124:      *             - vars array the recipient's merge variables
125:      *                 - vars[] struct a single merge variable
126:      *                     - name string the merge variable's name. Merge variable names are case-insensitive and may not start with _
127:      *                     - content mixed the merge variable's content
128:      *     - tags array an array of string to tag the message with.  Stats are accumulated using tags, though we only store the first 100 we see, so this should not be unique or change frequently.  Tags should be 50 characters or less.  Any tags starting with an underscore are reserved for internal use and will cause errors.
129:      *         - tags[] string a single tag - must not start with an underscore
130:      *     - subaccount string the unique id of a subaccount for this message - must already exist or will fail with an error
131:      *     - google_analytics_domains array an array of strings indicating for which any matching URLs will automatically have Google Analytics parameters appended to their query string automatically.
132:      *     - google_analytics_campaign array|string optional string indicating the value to set for the utm_campaign tracking parameter. If this isn't provided the email's from address will be used instead.
133:      *     - metadata array metadata an associative array of user metadata. Mandrill will store this metadata and make it available for retrieval. In addition, you can select up to 10 metadata fields to index and make searchable using the Mandrill search api.
134:      *     - recipient_metadata array Per-recipient metadata that will override the global values specified in the metadata parameter.
135:      *         - recipient_metadata[] struct metadata for a single recipient
136:      *             - rcpt string the email address of the recipient that the metadata is associated with
137:      *             - values array an associated array containing the recipient's unique metadata. If a key exists in both the per-recipient metadata and the global metadata, the per-recipient metadata will be used.
138:      *     - attachments array an array of supported attachments to add to the message
139:      *         - attachments[] struct a single supported attachment
140:      *             - type string the MIME type of the attachment
141:      *             - name string the file name of the attachment
142:      *             - content string the content of the attachment as a base64-encoded string
143:      *     - images array an array of embedded images to add to the message
144:      *         - images[] struct a single embedded image
145:      *             - type string the MIME type of the image - must start with "image/"
146:      *             - name string the Content ID of the image - use <img src="cid:THIS_VALUE"> to reference the image in your HTML content
147:      *             - content string the content of the image as a base64-encoded string
148:      * @param boolean $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.
149:      * @param string $ip_pool 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.
150:      * @param string $send_at when this message should be sent as a UTC timestamp in YYYY-MM-DD HH:MM:SS format. 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.
151:      * @return array of structs for each recipient containing the key "email" with the email address, and details of the message status for that recipient
152:      *     - return[] struct the sending results for a single recipient
153:      *         - email string the email address of the recipient
154:      *         - status string the sending status of the recipient - either "sent", "queued", "rejected", or "invalid"
155:      *         - reject_reason string the reason for the rejection if the recipient status is "rejected" - one of "hard-bounce", "soft-bounce", "spam", "unsub", "custom", "invalid-sender", "invalid", "test-mode-limit", or "rule"
156:      *         - _id string the message's unique id
157:      */
158:     public function sendTemplate($template_name, $template_content, $message, $async=false, $ip_pool=null, $send_at=null) {
159:         $_params = array("template_name" => $template_name, "template_content" => $template_content, "message" => $message, "async" => $async, "ip_pool" => $ip_pool, "send_at" => $send_at);
160:         return $this->master->call('messages/send-template', $_params);
161:     }
162: 
163:     /**
164:      * Search recently sent messages and optionally narrow by date range, tags, senders, and API keys. If no date range is specified, results within the last 7 days are returned. This method may be called up to 20 times per minute. If you need the data more often, you can use <a href="/api/docs/messages.html#method=info">/messages/info.json</a> to get the information for a single message, or <a href="http://help.mandrill.com/entries/21738186-Introduction-to-Webhooks">webhooks</a> to push activity to your own application for querying.
165:      * @param string $query <a href="http://help.mandrill.com/entries/22211902">search terms</a> to find matching messages
166:      * @param string $date_from start date
167:      * @param string $date_to end date
168:      * @param array $tags an array of tag names to narrow the search to, will return messages that contain ANY of the tags
169:      * @param array $senders an array of sender addresses to narrow the search to, will return messages sent by ANY of the senders
170:      * @param array $api_keys an array of API keys to narrow the search to, will return messages sent by ANY of the keys
171:      * @param integer $limit the maximum number of results to return, defaults to 100, 1000 is the maximum
172:      * @return array of structs for each matching message
173:      *     - return[] struct the information for a single matching message
174:      *         - ts integer the Unix timestamp from when this message was sent
175:      *         - _id string the message's unique id
176:      *         - sender string the email address of the sender
177:      *         - template string the unique name of the template used, if any
178:      *         - subject string the message's subject line
179:      *         - email string the recipient email address
180:      *         - tags array list of tags on this message
181:      *             - tags[] string individual tag on this message
182:      *         - opens integer how many times has this message been opened
183:      *         - opens_detail array list of individual opens for the message
184:      *             - opens_detail[] struct information on an individual open
185:      *                 - ts integer the unix timestamp from when the message was opened
186:      *                 - ip string the IP address that generated the open
187:      *                 - location string the approximate region and country that the opening IP is located
188:      *                 - ua string the email client or browser data of the open
189:      *         - clicks integer how many times has a link been clicked in this message
190:      *         - clicks_detail array list of individual clicks for the message
191:      *             - clicks_detail[] struct information on an individual click
192:      *                 - ts integer the unix timestamp from when the message was clicked
193:      *                 - url string the URL that was clicked on
194:      *                 - ip string the IP address that generated the click
195:      *                 - location string the approximate region and country that the clicking IP is located
196:      *                 - ua string the email client or browser data of the click
197:      *         - state string sending status of this message: sent, bounced, rejected
198:      *         - metadata struct any custom metadata provided when the message was sent
199:      *     - smtp_events array a log of up to 3 smtp events for the message
200:      *         - smtp_events[] struct information about a specific smtp event
201:      *             - ts integer the Unix timestamp when the event occured
202:      *             - type string the message's state as a result of this event
203:      *             - diag string the SMTP response from the recipient's server
204:      */
205:     public function search($query='*', $date_from=null, $date_to=null, $tags=null, $senders=null, $api_keys=null, $limit=100) {
206:         $_params = array("query" => $query, "date_from" => $date_from, "date_to" => $date_to, "tags" => $tags, "senders" => $senders, "api_keys" => $api_keys, "limit" => $limit);
207:         return $this->master->call('messages/search', $_params);
208:     }
209: 
210:     /**
211:      * Search the content of recently sent messages and return the aggregated hourly stats for matching messages
212:      * @param string $query the search terms to find matching messages for
213:      * @param string $date_from start date
214:      * @param string $date_to end date
215:      * @param array $tags an array of tag names to narrow the search to, will return messages that contain ANY of the tags
216:      * @param array $senders an array of sender addresses to narrow the search to, will return messages sent by ANY of the senders
217:      * @return array the array of history information
218:      *     - return[] struct the stats for a single hour
219:      *         - time string the hour as a UTC date string in YYYY-MM-DD HH:MM:SS format
220:      *         - sent integer the number of emails that were sent during the hour
221:      *         - hard_bounces integer the number of emails that hard bounced during the hour
222:      *         - soft_bounces integer the number of emails that soft bounced during the hour
223:      *         - rejects integer the number of emails that were rejected during the hour
224:      *         - complaints integer the number of spam complaints received during the hour
225:      *         - unsubs integer the number of unsubscribes received during the hour
226:      *         - opens integer the number of emails opened during the hour
227:      *         - unique_opens integer the number of unique opens generated by messages sent during the hour
228:      *         - clicks integer the number of tracked URLs clicked during the hour
229:      *         - unique_clicks integer the number of unique clicks generated by messages sent during the hour
230:      */
231:     public function searchTimeSeries($query='*', $date_from=null, $date_to=null, $tags=null, $senders=null) {
232:         $_params = array("query" => $query, "date_from" => $date_from, "date_to" => $date_to, "tags" => $tags, "senders" => $senders);
233:         return $this->master->call('messages/search-time-series', $_params);
234:     }
235: 
236:     /**
237:      * Get the information for a single recently sent message
238:      * @param string $id the unique id of the message to get - passed as the "_id" field in webhooks, send calls, or search calls
239:      * @return struct the information for the message
240:      *     - ts integer the Unix timestamp from when this message was sent
241:      *     - _id string the message's unique id
242:      *     - sender string the email address of the sender
243:      *     - template string the unique name of the template used, if any
244:      *     - subject string the message's subject line
245:      *     - email string the recipient email address
246:      *     - tags array list of tags on this message
247:      *         - tags[] string individual tag on this message
248:      *     - opens integer how many times has this message been opened
249:      *     - opens_detail array list of individual opens for the message
250:      *         - opens_detail[] struct information on an individual open
251:      *             - ts integer the unix timestamp from when the message was opened
252:      *             - ip string the IP address that generated the open
253:      *             - location string the approximate region and country that the opening IP is located
254:      *             - ua string the email client or browser data of the open
255:      *     - clicks integer how many times has a link been clicked in this message
256:      *     - clicks_detail array list of individual clicks for the message
257:      *         - clicks_detail[] struct information on an individual click
258:      *             - ts integer the unix timestamp from when the message was clicked
259:      *             - url string the URL that was clicked on
260:      *             - ip string the IP address that generated the click
261:      *             - location string the approximate region and country that the clicking IP is located
262:      *             - ua string the email client or browser data of the click
263:      *     - state string sending status of this message: sent, bounced, rejected
264:      *     - metadata struct any custom metadata provided when the message was sent
265:      *     - smtp_events array a log of up to 3 smtp events for the message
266:      *         - smtp_events[] struct information about a specific smtp event
267:      *             - ts integer the Unix timestamp when the event occured
268:      *             - type string the message's state as a result of this event
269:      *             - diag string the SMTP response from the recipient's server
270:      */
271:     public function info($id) {
272:         $_params = array("id" => $id);
273:         return $this->master->call('messages/info', $_params);
274:     }
275: 
276:     /**
277:      * Get the full content of a recently sent message
278:      * @param string $id the unique id of the message to get - passed as the "_id" field in webhooks, send calls, or search calls
279:      * @return struct the content of the message
280:      *     - ts integer the Unix timestamp from when this message was sent
281:      *     - _id string the message's unique id
282:      *     - from_email string the email address of the sender
283:      *     - from_name string the alias of the sender (if any)
284:      *     - subject string the message's subject line
285:      *     - to struct the message recipient's information
286:      *         - email string the email address of the recipient
287:      *         - name string the alias of the recipient (if any)
288:      *     - tags array list of tags on this message
289:      *         - tags[] string individual tag on this message
290:      *     - headers struct the key-value pairs of the custom MIME headers for the message's main document
291:      *     - text string the text part of the message, if any
292:      *     - html string the HTML part of the message, if any
293:      *     - attachments array an array of any attachments that can be found in the message
294:      *         - attachments[] struct information about an individual attachment
295:      *             - name string the file name of the attachment
296:      *             - type string the MIME type of the attachment
297:      *             - content string the content of the attachment as a base64 encoded string
298:      */
299:     public function content($id) {
300:         $_params = array("id" => $id);
301:         return $this->master->call('messages/content', $_params);
302:     }
303: 
304:     /**
305:      * Parse the full MIME document for an email message, returning the content of the message broken into its constituent pieces
306:      * @param string $raw_message the full MIME document of an email message
307:      * @return struct the parsed message
308:      *     - subject string the subject of the message
309:      *     - from_email string the email address of the sender
310:      *     - from_name string the alias of the sender (if any)
311:      *     - to array an array of any recipients in the message
312:      *         - to[] struct the information on a single recipient
313:      *             - email string the email address of the recipient
314:      *             - name string the alias of the recipient (if any)
315:      *     - headers struct the key-value pairs of the MIME headers for the message's main document
316:      *     - text string the text part of the message, if any
317:      *     - html string the HTML part of the message, if any
318:      *     - attachments array an array of any attachments that can be found in the message
319:      *         - attachments[] struct information about an individual attachment
320:      *             - name string the file name of the attachment
321:      *             - type string the MIME type of the attachment
322:      *             - binary boolean if this is set to true, the attachment is not pure-text, and the content will be base64 encoded
323:      *             - content string the content of the attachment as a text string or a base64 encoded string based on the attachment type
324:      *     - images array an array of any embedded images that can be found in the message
325:      *         - images[] struct information about an individual image
326:      *             - name string the Content-ID of the embedded image
327:      *             - type string the MIME type of the image
328:      *             - content string the content of the image as a base64 encoded string
329:      */
330:     public function parse($raw_message) {
331:         $_params = array("raw_message" => $raw_message);
332:         return $this->master->call('messages/parse', $_params);
333:     }
334: 
335:     /**
336:      * Take a raw MIME document for a message, and send it exactly as if it were sent through Mandrill's SMTP servers
337:      * @param string $raw_message the full MIME document of an email message
338:      * @param string|null $from_email optionally define the sender address - otherwise we'll use the address found in the provided headers
339:      * @param string|null $from_name optionally define the sender alias
340:      * @param array|null $to optionally define the recipients to receive the message - otherwise we'll use the To, Cc, and Bcc headers provided in the document
341:      *     - to[] string the email address of the recipient
342:      * @param boolean $async enable a background sending mode that is optimized for bulk sending. In async mode, messages/sendRaw 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.
343:      * @param string $ip_pool 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.
344:      * @param string $send_at when this message should be sent as a UTC timestamp in YYYY-MM-DD HH:MM:SS format. If you specify a time in the past, the message will be sent immediately.
345:      * @param string $return_path_domain a custom domain to use for the messages's return-path
346:      * @return array of structs for each recipient containing the key "email" with the email address, and details of the message status for that recipient
347:      *     - return[] struct the sending results for a single recipient
348:      *         - email string the email address of the recipient
349:      *         - status string the sending status of the recipient - either "sent", "queued", "scheduled", "rejected", or "invalid"
350:      *         - reject_reason string the reason for the rejection if the recipient status is "rejected" - one of "hard-bounce", "soft-bounce", "spam", "unsub", "custom", "invalid-sender", "invalid", "test-mode-limit", or "rule"
351:      *         - _id string the message's unique id
352:      */
353:     public function sendRaw($raw_message, $from_email=null, $from_name=null, $to=null, $async=false, $ip_pool=null, $send_at=null, $return_path_domain=null) {
354:         $_params = array("raw_message" => $raw_message, "from_email" => $from_email, "from_name" => $from_name, "to" => $to, "async" => $async, "ip_pool" => $ip_pool, "send_at" => $send_at, "return_path_domain" => $return_path_domain);
355:         return $this->master->call('messages/send-raw', $_params);
356:     }
357: 
358:     /**
359:      * Queries your scheduled emails.
360:      * @param string $to an optional recipient address to restrict results to
361:      * @return array a list of up to 1000 scheduled emails
362:      *     - return[] struct a scheduled email
363:      *         - _id string the scheduled message id
364:      *         - created_at string the UTC timestamp when the message was created, in YYYY-MM-DD HH:MM:SS format
365:      *         - send_at string the UTC timestamp when the message will be sent, in YYYY-MM-DD HH:MM:SS format
366:      *         - from_email string the email's sender address
367:      *         - to string the email's recipient
368:      *         - subject string the email's subject
369:      */
370:     public function listScheduled($to=null) {
371:         $_params = array("to" => $to);
372:         return $this->master->call('messages/list-scheduled', $_params);
373:     }
374: 
375:     /**
376:      * Cancels a scheduled email.
377:      * @param string $id a scheduled email id, as returned by any of the messages/send calls or messages/list-scheduled
378:      * @return struct information about the scheduled email that was cancelled.
379:      *     - _id string the scheduled message id
380:      *     - created_at string the UTC timestamp when the message was created, in YYYY-MM-DD HH:MM:SS format
381:      *     - send_at string the UTC timestamp when the message will be sent, in YYYY-MM-DD HH:MM:SS format
382:      *     - from_email string the email's sender address
383:      *     - to string the email's recipient
384:      *     - subject string the email's subject
385:      */
386:     public function cancelScheduled($id) {
387:         $_params = array("id" => $id);
388:         return $this->master->call('messages/cancel-scheduled', $_params);
389:     }
390: 
391:     /**
392:      * Reschedules a scheduled email.
393:      * @param string $id a scheduled email id, as returned by any of the messages/send calls or messages/list-scheduled
394:      * @param string $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
395:      * @return struct information about the scheduled email that was rescheduled.
396:      *     - _id string the scheduled message id
397:      *     - created_at string the UTC timestamp when the message was created, in YYYY-MM-DD HH:MM:SS format
398:      *     - send_at string the UTC timestamp when the message will be sent, in YYYY-MM-DD HH:MM:SS format
399:      *     - from_email string the email's sender address
400:      *     - to string the email's recipient
401:      *     - subject string the email's subject
402:      */
403:     public function reschedule($id, $send_at) {
404:         $_params = array("id" => $id, "send_at" => $send_at);
405:         return $this->master->call('messages/reschedule', $_params);
406:     }
407: 
408: }
409: 
410: 
411: 
API documentation generated by ApiGen 2.8.0