Class: Mandrill::Rejects

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(master) ⇒ Rejects

Returns a new instance of Rejects.



410
411
412
# File 'lib/mandrill/api.rb', line 410

def initialize(master)
    @master = master
end

Instance Attribute Details

#masterObject

Returns the value of attribute master.



408
409
410
# File 'lib/mandrill/api.rb', line 408

def master
  @master
end

Instance Method Details

#add(email) ⇒ Hash

Adds an email to your email rejection blacklist. Addresses that you add manually will never expire and there is no reputation penalty for removing them from your blacklist. Attempting to blacklist an address that has been whitelisted will have no effect.

Parameters:

  • email (String)

    an email address to block

Returns:

  • (Hash)

    a status object containing the address and the result of the operation

    • String

      email the email address you provided

    • Boolean

      added whether the operation succeeded



419
420
421
422
# File 'lib/mandrill/api.rb', line 419

def add(email)
    _params = {:email => email}
    return @master.call 'rejects/add', _params
end

#delete(email) ⇒ Hash

Deletes an email rejection. There is no limit to how many rejections you can remove from your blacklist, but keep in mind that each deletion has an affect on your reputation.

Parameters:

  • email (String)

    an email address

Returns:

  • (Hash)

    a status object containing the address and whether the deletion succeeded.

    • String

      email the email address that was removed from the blacklist

    • Boolean

      deleted whether the address was deleted successfully.



459
460
461
462
# File 'lib/mandrill/api.rb', line 459

def delete(email)
    _params = {:email => email}
    return @master.call 'rejects/delete', _params
end

#list(email = nil, include_expired = false) ⇒ Array

Retrieves your email rejection blacklist. You can provide an email address to limit the results. Returns up to 1000 results. By default, entries that have expired are excluded from the results; set include_expired to true to include them.

Parameters:

  • email (String) (defaults to: nil)

    an optional email address to search by

  • include_expired (Boolean) (defaults to: false)

    whether to include rejections that have already expired.

Returns:

  • (Array)

    Up to 1000 rejection entries

    • Hash

      return[] the information for each rejection blacklist entry

      - [String] email the email that is blocked
      - [String] reason the type of event (hard-bounce, soft-bounce, spam, unsub) that caused this rejection
      - [String] detail extended details about the event, such as the SMTP diagnostic for bounces or the comment for manually-created rejections
      - [String] created_at when the email was added to the blacklist
      - [String] last_event_at the timestamp of the most recent event that either created or renewed this rejection
      - [String] expires_at when the blacklist entry will expire (this may be in the past)
      - [Boolean] expired whether the blacklist entry has expired
      - [Hash] sender the sender that this blacklist entry applies to, or null if none.
          - [String] address the sender's email address
          - [String] created_at the date and time that the sender was first seen by Mandrill as a UTC date string in YYYY-MM-DD HH:MM:SS format
          - [Integer] sent the total number of messages sent by this sender
          - [Integer] hard_bounces the total number of hard bounces by messages by this sender
          - [Integer] soft_bounces the total number of soft bounces by messages by this sender
          - [Integer] rejects the total number of rejected messages by this sender
          - [Integer] complaints the total number of spam complaints received for messages by this sender
          - [Integer] unsubs the total number of unsubscribe requests received for messages by this sender
          - [Integer] opens the total number of times messages by this sender have been opened
          - [Integer] clicks the total number of times tracked URLs in messages by this sender have been clicked
          - [Integer] unique_opens the number of unique opens for emails sent for this sender
          - [Integer] unique_clicks the number of unique clicks for emails sent for this sender
      


449
450
451
452
# File 'lib/mandrill/api.rb', line 449

def list(email=nil, include_expired=false)
    _params = {:email => email, :include_expired => include_expired}
    return @master.call 'rejects/list', _params
end