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