class Mandrill::Messages
- Mandrill::Messages
- Reference
- Object
Defined in:
mandrill/api.crConstructors
Instance Method Summary
-
#cancel_scheduled(id)
Cancels a scheduled email.
-
#content(id)
Get the full content of a recently sent message @param [String] id the unique id of the message to get - passed as the "_id" field in webhooks, send calls, or search calls @return [Hash] the content of the message - [Integer] ts the Unix timestamp from when this message was sent - [String] id the message's unique id - [String] fromemail the email address of the sender - [String] from_name the alias of the sender (if any) - [String] subject the message's subject line - [Hash] to the message recipient's information - [String] email the email address of the recipient - [String] name the alias of the recipient (if any) - [Array] tags list of tags on this message - [String] tags[] individual tag on this message - [Hash] headers the key-value pairs of the custom MIME headers for the message's main document - [String] text the text part of the message, if any - [String] html the HTML part of the message, if any - [Array] attachments an array of any attachments that can be found in the message - [Hash] attachments[] information about an individual attachment - [String] name the file name of the attachment - [String] type the MIME type of the attachment - [String] content the content of the attachment as a base64 encoded string
-
#info(id)
Get the information for a single recently sent message @param [String] id the unique id of the message to get - passed as the "_id" field in webhooks, send calls, or search calls @return [Hash] the information for the message - [Integer] ts the Unix timestamp from when this message was sent - [String] id the message's unique id - [String] sender the email address of the sender - [String] template the unique name of the template used, if any - [String] subject the message's subject line - [String] email the recipient email address - [Array] tags list of tags on this message - [String] tags[] individual tag on this message - [Integer] opens how many times has this message been opened - [Array] opensdetail list of individual opens for the message - [Hash] opens_detail[] information on an individual open - [Integer] ts the unix timestamp from when the message was opened - [String] ip the IP address that generated the open - [String] location the approximate region and country that the opening IP is located - [String] ua the email client or browser data of the open - [Integer] clicks how many times has a link been clicked in this message - [Array] clicks_detail list of individual clicks for the message - [Hash] clicks_detail[] information on an individual click - [Integer] ts the unix timestamp from when the message was clicked - [String] url the URL that was clicked on - [String] ip the IP address that generated the click - [String] location the approximate region and country that the clicking IP is located - [String] ua the email client or browser data of the click - [String] state sending status of this message: sent, bounced, rejected - [Hash] metadata any custom metadata provided when the message was sent - [Array] smtp_events a log of up to 3 smtp events for the message - [Hash] smtp_events[] information about a specific smtp event - [Integer] ts the Unix timestamp when the event occured - [String] type the message's state as a result of this event - [String] diag the SMTP response from the recipient's server
-
#list_scheduled(to = nil)
Queries your scheduled emails.
-
#parse(raw_message)
Parse the full MIME document for an email message, returning the content of the message broken into its constituent pieces @param [String] raw_message the full MIME document of an email message @return [Hash] the parsed message - [String] subject the subject of the message - [String] from_email the email address of the sender - [String] from_name the alias of the sender (if any) - [Array] to an array of any recipients in the message - [Hash] to[] the information on a single recipient - [String] email the email address of the recipient - [String] name the alias of the recipient (if any) - [Hash] headers the key-value pairs of the MIME headers for the message's main document - [String] text the text part of the message, if any - [String] html the HTML part of the message, if any - [Array] attachments an array of any attachments that can be found in the message - [Hash] attachments[] information about an individual attachment - [String] name the file name of the attachment - [String] type the MIME type of the attachment - [Boolean] binary if this is set to true, the attachment is not pure-text, and the content will be base64 encoded - [String] content the content of the attachment as a text string or a base64 encoded string based on the attachment type - [Array] images an array of any embedded images that can be found in the message - [Hash] images[] information about an individual image - [String] name the Content-ID of the embedded image - [String] type the MIME type of the image - [String] content the content of the image as a base64 encoded string
-
#reschedule(id, send_at)
Reschedules a scheduled email.
-
#search(query = '*', date_from = nil, date_to = nil, tags = nil, senders = nil, api_keys = nil, limit = 100)
Search recently sent messages and optionally narrow by date range, tags, senders, and API keys.
-
#search_time_series(query = '*', date_from = nil, date_to = nil, tags = nil, senders = nil)
Search the content of recently sent messages and return the aggregated hourly stats for matching messages @param [String] query the search terms to find matching messages for @param [String] date_from start date @param [String] date_to end date @param [Array] tags an array of tag names to narrow the search to, will return messages that contain ANY of the tags @param [Array] senders an array of sender addresses to narrow the search to, will return messages sent by ANY of the senders @return [Array] the array of history information - [Hash] return[] the stats for a single hour - [String] time the hour as a UTC date string in YYYY-MM-DD HH:MM:SS format - [Integer] sent the number of emails that were sent during the hour - [Integer] hard_bounces the number of emails that hard bounced during the hour - [Integer] soft_bounces the number of emails that soft bounced during the hour - [Integer] rejects the number of emails that were rejected during the hour - [Integer] complaints the number of spam complaints received during the hour - [Integer] unsubs the number of unsubscribes received during the hour - [Integer] opens the number of emails opened during the hour - [Integer] unique_opens the number of unique opens generated by messages sent during the hour - [Integer] clicks the number of tracked URLs clicked during the hour - [Integer] unique_clicks the number of unique clicks generated by messages sent during the hour
-
#send(message, async = false, ip_pool = nil, send_at = nil)
Send a new transactional message through Mandrill @param [Hash] message the information on the message to send - [String] html the full HTML content to be sent - [String] text optional full text content to be sent - [String] subject the message subject - [String] from_email the sender email address.
-
#send_raw(raw_message, from_email = nil, from_name = nil, to = nil, async = false, ip_pool = nil, send_at = nil, return_path_domain = nil)
Take a raw MIME document for a message, and send it exactly as if it were sent through Mandrill's SMTP servers @param [String] raw_message the full MIME document of an email message @param [String, nil] from_email optionally define the sender address - otherwise we'll use the address found in the provided headers @param [String, nil] from_name optionally define the sender alias @param [Array, nil] to optionally define the recipients to receive the message - otherwise we'll use the To, Cc, and Bcc headers provided in the document - [String] to[] the email address of the recipient @param [Boolean] async enable a background sending mode that is optimized for bulk sending.
-
#send_template(template_name, template_content, message, async = false, ip_pool = nil, send_at = nil)
Send a new transactional message through Mandrill using a template @param [String] template_name the immutable name or slug of a template that exists in the user's account.
Constructor Detail
Instance Method Detail
Cancels a scheduled email. @param [String] id a scheduled email id, as returned by any of the messages/send calls or messages/list-scheduled @return [Hash] information about the scheduled email that was cancelled.
- [String] _id the scheduled message id
- [String] created_at the UTC timestamp when the message was created, in YYYY-MM-DD HH:MM:SS format
- [String] send_at the UTC timestamp when the message will be sent, in YYYY-MM-DD HH:MM:SS format
- [String] from_email the email
Get the full content of a recently sent message @param [String] id the unique id of the message to get - passed as the "_id" field in webhooks, send calls, or search calls @return [Hash] the content of the message
- [Integer] ts the Unix timestamp from when this message was sent
- [String] _id the message
Get the information for a single recently sent message @param [String] id the unique id of the message to get - passed as the "_id" field in webhooks, send calls, or search calls @return [Hash] the information for the message
- [Integer] ts the Unix timestamp from when this message was sent
- [String] _id the message
Queries your scheduled emails. @param [String] to an optional recipient address to restrict results to @return [Array] a list of up to 1000 scheduled emails
- [Hash] return[] a scheduled email
- [String] _id the scheduled message id
- [String] created_at the UTC timestamp when the message was created, in YYYY-MM-DD HH:MM:SS format
- [String] send_at the UTC timestamp when the message will be sent, in YYYY-MM-DD HH:MM:SS format
- [String] from_email the email
Parse the full MIME document for an email message, returning the content of the message broken into its constituent pieces @param [String] raw_message the full MIME document of an email message @return [Hash] the parsed message
- [String] subject the subject of the message
- [String] from_email the email address of the sender
- [String] from_name the alias of the sender (if any)
- [Array] to an array of any recipients in the message
- [Hash] to[] the information on a single recipient
- [String] email the email address of the recipient
- [String] name the alias of the recipient (if any)
- [Hash] headers the key-value pairs of the MIME headers for the message
Reschedules a scheduled email. @param [String] id a scheduled email id, as returned by any of the messages/send calls or messages/list-scheduled @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 @return [Hash] information about the scheduled email that was rescheduled.
- [String] _id the scheduled message id
- [String] created_at the UTC timestamp when the message was created, in YYYY-MM-DD HH:MM:SS format
- [String] send_at the UTC timestamp when the message will be sent, in YYYY-MM-DD HH:MM:SS format
- [String] from_email the email
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. @param [String] query <a href="http://help.mandrill.com/entries/22211902">search terms</a> to find matching messages @param [String] date_from start date @param [String] date_to end date @param [Array] tags an array of tag names to narrow the search to, will return messages that contain ANY of the tags @param [Array] senders an array of sender addresses to narrow the search to, will return messages sent by ANY of the senders @param [Array] api_keys an array of API keys to narrow the search to, will return messages sent by ANY of the keys @param [Integer] limit the maximum number of results to return, defaults to 100, 1000 is the maximum @return [Array] of structs for each matching message
- [Hash] return[] the information for a single matching message
- [Integer] ts the Unix timestamp from when this message was sent
- [String] _id the message
Search the content of recently sent messages and return the aggregated hourly stats for matching messages @param [String] query the search terms to find matching messages for @param [String] date_from start date @param [String] date_to end date @param [Array] tags an array of tag names to narrow the search to, will return messages that contain ANY of the tags @param [Array] senders an array of sender addresses to narrow the search to, will return messages sent by ANY of the senders @return [Array] the array of history information
- [Hash] return[] the stats for a single hour
- [String] time the hour as a UTC date string in YYYY-MM-DD HH:MM:SS format
- [Integer] sent the number of emails that were sent during the hour
- [Integer] hard_bounces the number of emails that hard bounced during the hour
- [Integer] soft_bounces the number of emails that soft bounced during the hour
- [Integer] rejects the number of emails that were rejected during the hour
- [Integer] complaints the number of spam complaints received during the hour
- [Integer] unsubs the number of unsubscribes received during the hour
- [Integer] opens the number of emails opened during the hour
- [Integer] unique_opens the number of unique opens generated by messages sent during the hour
- [Integer] clicks the number of tracked URLs clicked during the hour
- [Integer] unique_clicks the number of unique clicks generated by messages sent during the hour
Send a new transactional message through Mandrill @param [Hash] message the information on the message to send
- [String] html the full HTML content to be sent
- [String] text optional full text content to be sent
- [String] subject the message subject
- [String] from_email the sender email address.
- [String] from_name optional from name to be used
- [Array] to an array of recipient information.
- [Hash] to[] a single recipient
@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. @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. @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. @return [Array] of structs for each recipient containing the key "email" with the email address, and details of the message status for that recipient
- [Hash] return[] the sending results for a single recipient
- [String] email the email address of the recipient
- [String] status the sending status of the recipient - either "sent", "queued", "scheduled", "rejected", or "invalid"
- [String] reject_reason 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"
- [String] _id the message
Take a raw MIME document for a message, and send it exactly as if it were sent through Mandrill's SMTP servers @param [String] raw_message the full MIME document of an email message @param [String, nil] from_email optionally define the sender address - otherwise we'll use the address found in the provided headers @param [String, nil] from_name optionally define the sender alias @param [Array, nil] to optionally define the recipients to receive the message - otherwise we'll use the To, Cc, and Bcc headers provided in the document
- [String] to[] the email address of the recipient
@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. @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. @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. @param [String] return_path_domain a custom domain to use for the messages's return-path @return [Array] of structs for each recipient containing the key "email" with the email address, and details of the message status for that recipient
- [Hash] return[] the sending results for a single recipient
- [String] email the email address of the recipient
- [String] status the sending status of the recipient - either "sent", "queued", "scheduled", "rejected", or "invalid"
- [String] reject_reason 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"
- [String] _id the message
Send a new transactional message through Mandrill using a template @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. @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
- [Hash] template_content[] the injection of a single piece of content into a single editable region
- [String] name the name of the mc:edit editable region to inject into
- [String] content the content to inject
@param [Hash] message the other information on the message to send - same as /messages/send, but without the html content
- [String] html optional full HTML content to be sent if not in template
- [String] text optional full text content to be sent
- [String] subject the message subject
- [String] from_email the sender email address.
- [String] from_name optional from name to be used
- [Array] to an array of recipient information.
- [Hash] to[] a single recipient
@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. @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. @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. @return [Array] of structs for each recipient containing the key "email" with the email address, and details of the message status for that recipient
- [Hash] return[] the sending results for a single recipient
- [String] email the email address of the recipient
- [String] status the sending status of the recipient - either "sent", "queued", "rejected", or "invalid"
- [String] reject_reason 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"
- [String] _id the message