Method: Mandrill::Messages#send_raw

Defined in:
lib/mandrill/api.rb

#send_raw(raw_message, from_email = nil, from_name = nil, to = nil, async = false, ip_pool = nil, send_at = nil, return_path_domain = nil) ⇒ Array

Take a raw MIME document for a message, and send it exactly as if it were sent through Mandrill’s SMTP servers

Parameters:

  • raw_message (String)

    the full MIME document of an email message

  • from_email (String, nil) (defaults to: nil)

    optionally define the sender address - otherwise we’ll use the address found in the provided headers

  • from_name (String, nil) (defaults to: nil)

    optionally define the sender alias

  • to (Array, nil) (defaults to: nil)

    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

  • async (Boolean) (defaults to: false)

    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.

  • ip_pool (String) (defaults to: nil)

    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.

  • send_at (String) (defaults to: nil)

    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.

  • return_path_domain (String) (defaults to: nil)

    a custom domain to use for the messages’s return-path

Returns:

  • (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's unique id
      


1102
1103
1104
1105
# File 'lib/mandrill/api.rb', line 1102

def send_raw(raw_message, from_email=nil, from_name=nil, to=nil, async=false, ip_pool=nil, send_at=nil, return_path_domain=nil)
    _params = {: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}
    return @master.call 'messages/send-raw', _params
end