     1: <?php
     2:
     3: class Mandrill_Rejects {
     4:     public function __construct(Mandrill $master) {
     5:         $this->master = $master;
     6:     }
     7:
     8:     /**
     9:      * Adds an email to your email rejection blacklist. Addresses that you
    10: add manually will never expire and there is no reputation penalty
    11: for removing them from your blacklist. Attempting to blacklist an
    12: address that has been whitelisted will have no effect.
    13:      * @param string $email an email address to block
    14:      * @param string $comment an optional comment describing the rejection
    15:      * @param string $subaccount an optional unique identifier for the subaccount to limit the blacklist entry
    16:      * @return struct a status object containing the address and the result of the operation
    17:      *     - email string the email address you provided
    18:      *     - added boolean whether the operation succeeded
    19:      */
    20:     public function add($email, $comment=null, $subaccount=null) {
    21:         $_params = array("email" => $email, "comment" => $comment, "subaccount" => $subaccount);
    22:         return $this->master->call('rejects/add', $_params);
    23:     }
    24:
    25:     /**
    26:      * Retrieves your email rejection blacklist. You can provide an email
    27: address to limit the results. Returns up to 1000 results. By default,
    28: entries that have expired are excluded from the results; set
    29: include_expired to true to include them.
    30:      * @param string $email an optional email address to search by
    31:      * @param boolean $include_expired whether to include rejections that have already expired.
    32:      * @param string $subaccount an optional unique identifier for the subaccount to limit the blacklist
    33:      * @return array Up to 1000 rejection entries
    34:      *     - return[] struct the information for each rejection blacklist entry
    35:      *         - email string the email that is blocked
    36:      *         - reason string the type of event (hard-bounce, soft-bounce, spam, unsub) that caused this rejection
    37:      *         - detail string extended details about the event, such as the SMTP diagnostic for bounces or the comment for manually-created rejections
    38:      *         - created_at string when the email was added to the blacklist
    39:      *         - last_event_at string the timestamp of the most recent event that either created or renewed this rejection
    40:      *         - expires_at string when the blacklist entry will expire (this may be in the past)
    41:      *         - expired boolean whether the blacklist entry has expired
    42:      *         - sender struct the sender that this blacklist entry applies to, or null if none.
    43:      *             - address string the sender's email address
    44:      *             - created_at string 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
    45:      *             - sent integer the total number of messages sent by this sender
    46:      *             - hard_bounces integer the total number of hard bounces by messages by this sender
    47:      *             - soft_bounces integer the total number of soft bounces by messages by this sender
    48:      *             - rejects integer the total number of rejected messages by this sender
    49:      *             - complaints integer the total number of spam complaints received for messages by this sender
    50:      *             - unsubs integer the total number of unsubscribe requests received for messages by this sender
    51:      *             - opens integer the total number of times messages by this sender have been opened
    52:      *             - clicks integer the total number of times tracked URLs in messages by this sender have been clicked
    53:      *             - unique_opens integer the number of unique opens for emails sent for this sender
    54:      *             - unique_clicks integer the number of unique clicks for emails sent for this sender
    55:      *         - subaccount string the subaccount that this blacklist entry applies to, or null if none.
    56:      */
    57:     public function getList($email=null, $include_expired=false, $subaccount=null) {
    58:         $_params = array("email" => $email, "include_expired" => $include_expired, "subaccount" => $subaccount);
    59:         return $this->master->call('rejects/list', $_params);
    60:     }
    61:
    62:     /**
    63:      * Deletes an email rejection. There is no limit to how many rejections
    64: you can remove from your blacklist, but keep in mind that each deletion
    65: has an affect on your reputation.
    66:      * @param string $email an email address
    67:      * @param string $subaccount an optional unique identifier for the subaccount to limit the blacklist deletion
    68:      * @return struct a status object containing the address and whether the deletion succeeded.
    69:      *     - email string the email address that was removed from the blacklist
    70:      *     - deleted boolean whether the address was deleted successfully.
    71:      *     - subaccount string the subaccount blacklist that the address was removed from, if any
    72:      */
    73:     public function delete($email, $subaccount=null) {
    74:         $_params = array("email" => $email, "subaccount" => $subaccount);
    75:         return $this->master->call('rejects/delete', $_params);
    76:     }
    77:
    78: }
    79:
    80:
    81: