summaryrefslogtreecommitdiff
path: root/Postman/Postman-Mail/mailchimp-mandrill-api-php-da3adc10042e/src/Mandrill/Whitelists.php
blob: fe734452f65ffcff8583c078acee57bfd011dc5c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php

class Postman_Mandrill_Whitelists {
    public function __construct(Postman_Mandrill $master) {
        $this->master = $master;
    }

    /**
     * Adds an email to your email rejection whitelist. If the address is
currently on your blacklist, that blacklist entry will be removed
automatically.
     * @param string $email an email address to add to the whitelist
     * @param string $comment an optional description of why the email was whitelisted
     * @return struct a status object containing the address and the result of the operation
     *     - email string the email address you provided
     *     - added boolean whether the operation succeeded
     */
    public function add($email, $comment=null) {
        $_params = array("email" => $email, "comment" => $comment);
        return $this->master->call('whitelists/add', $_params);
    }

    /**
     * Retrieves your email rejection whitelist. You can provide an email
address or search prefix to limit the results. Returns up to 1000 results.
     * @param string $email an optional email address or prefix to search by
     * @return array up to 1000 whitelist entries
     *     - return[] struct the information for each whitelist entry
     *         - email string the email that is whitelisted
     *         - detail string a description of why the email was whitelisted
     *         - created_at string when the email was added to the whitelist
     */
    public function getList($email=null) {
        $_params = array("email" => $email);
        return $this->master->call('whitelists/list', $_params);
    }

    /**
     * Removes an email address from the whitelist.
     * @param string $email the email address to remove from the whitelist
     * @return struct a status object containing the address and whether the deletion succeeded
     *     - email string the email address that was removed from the blacklist
     *     - deleted boolean whether the address was deleted successfully
     */
    public function delete($email) {
        $_params = array("email" => $email);
        return $this->master->call('whitelists/delete', $_params);
    }

}