|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
class Mandrill_Whitelists |
|
4
|
|
|
{ |
|
5
|
|
|
|
|
6
|
|
|
public function __construct(Mandrill $master) |
|
7
|
|
|
{ |
|
8
|
|
|
$this->master = $master; |
|
|
|
|
|
|
9
|
|
|
} |
|
10
|
|
|
|
|
11
|
|
|
/** |
|
12
|
|
|
* Adds an email to your email rejection whitelist. If the address is |
|
13
|
|
|
currently on your blacklist, that blacklist entry will be removed |
|
14
|
|
|
automatically. |
|
15
|
|
|
* @param string $email an email address to add to the whitelist |
|
16
|
|
|
* @param string $comment an optional description of why the email was whitelisted |
|
17
|
|
|
* @return struct a status object containing the address and the result of the operation |
|
|
|
|
|
|
18
|
|
|
* - email string the email address you provided |
|
19
|
|
|
* - added boolean whether the operation succeeded |
|
20
|
|
|
*/ |
|
21
|
|
|
public function add($email, $comment = null) |
|
22
|
|
|
{ |
|
23
|
|
|
$_params = array("email" => $email, "comment" => $comment); |
|
24
|
|
|
return $this->master->call('whitelists/add', $_params); |
|
25
|
|
|
} |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* Retrieves your email rejection whitelist. You can provide an email |
|
29
|
|
|
address or search prefix to limit the results. Returns up to 1000 results. |
|
30
|
|
|
* @param string $email an optional email address or prefix to search by |
|
31
|
|
|
* @return array up to 1000 whitelist entries |
|
32
|
|
|
* - return[] struct the information for each whitelist entry |
|
33
|
|
|
* - email string the email that is whitelisted |
|
34
|
|
|
* - detail string a description of why the email was whitelisted |
|
35
|
|
|
* - created_at string when the email was added to the whitelist |
|
36
|
|
|
*/ |
|
37
|
|
|
public function getList($email = null) |
|
38
|
|
|
{ |
|
39
|
|
|
$_params = array("email" => $email); |
|
40
|
|
|
return $this->master->call('whitelists/list', $_params); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* Removes an email address from the whitelist. |
|
45
|
|
|
* @param string $email the email address to remove from the whitelist |
|
46
|
|
|
* @return struct a status object containing the address and whether the deletion succeeded |
|
47
|
|
|
* - email string the email address that was removed from the blacklist |
|
48
|
|
|
* - deleted boolean whether the address was deleted successfully |
|
49
|
|
|
*/ |
|
50
|
|
|
public function delete($email) |
|
51
|
|
|
{ |
|
52
|
|
|
$_params = array("email" => $email); |
|
53
|
|
|
return $this->master->call('whitelists/delete', $_params); |
|
54
|
|
|
} |
|
55
|
|
|
} |
|
56
|
|
|
|