Class: Mandrill::Inbound

Inherits:
Object
  • Object
show all
Defined in:
lib/mandrill/api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(master) ⇒ Inbound

Returns a new instance of Inbound.



468
469
470
# File 'lib/mandrill/api.rb', line 468

def initialize(master)
    @master = master
end

Instance Attribute Details

#masterObject

Returns the value of attribute master.



466
467
468
# File 'lib/mandrill/api.rb', line 466

def master
  @master
end

Instance Method Details

#domainsArray

List the domains that have been configured for inbound delivery

Returns:

  • (Array)

    the inbound domains associated with the account

    • Hash

      return[] the individual domain info

      - [String] domain the domain name that is accepting mail
      - [String] created_at the date and time that the inbound domain was added as a UTC string in YYYY-MM-DD HH:MM:SS format
      - [Boolean] valid_mx true if this inbound domain has successfully set up an MX record to deliver mail to the Mandrill servers
      


478
479
480
481
# File 'lib/mandrill/api.rb', line 478

def domains()
    _params = {}
    return @master.call 'inbound/domains', _params
end

#routes(domain) ⇒ Array

List the mailbox routes defined for an inbound domain

Parameters:

  • domain (String)

    the domain to check

Returns:

  • (Array)

    the routes associated with the domain

    • Hash

      return[] the individual mailbox route

      - [String] pattern the search pattern that the mailbox name should match
      - [String] url the webhook URL where inbound messages will be published
      


489
490
491
492
# File 'lib/mandrill/api.rb', line 489

def routes(domain)
    _params = {:domain => domain}
    return @master.call 'inbound/routes', _params
end

#send_raw(raw_message, to = nil, mail_from = nil, helo = nil, client_address = nil) ⇒ Array

Take a raw MIME document destined for a domain with inbound domains set up, and send it to the inbound hook exactly as if it had been sent over SMTP

Parameters:

  • raw_message (String)

    the full MIME document of an email message

  • 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

  • mail_from (String) (defaults to: nil)

    the address specified in the MAIL FROM stage of the SMTP conversation. Required for the SPF check.

  • helo (String) (defaults to: nil)

    the identification provided by the client mta in the MTA state of the SMTP conversation. Required for the SPF check.

  • client_address (String) (defaults to: nil)

    the remote MTA’s ip address. Optional; required for the SPF check.

Returns:

  • (Array)

    an array of the information for each recipient in the message (usually one) that matched an inbound route

    • Hash

      return[] the individual recipient information

      - [String] email the email address of the matching recipient
      - [String] pattern the mailbox route pattern that the recipient matched
      - [String] url the webhook URL that the message was posted to
      


506
507
508
509
# File 'lib/mandrill/api.rb', line 506

def send_raw(raw_message, to=nil, mail_from=nil, helo=nil, client_address=nil)
    _params = {:raw_message => raw_message, :to => to, :mail_from => mail_from, :helo => helo, :client_address => client_address}
    return @master.call 'inbound/send-raw', _params
end