|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
class Mandrill_Senders |
|
4
|
|
|
{ |
|
5
|
|
|
|
|
6
|
|
|
public function __construct(Mandrill $master) |
|
7
|
|
|
{ |
|
8
|
|
|
$this->master = $master; |
|
|
|
|
|
|
9
|
|
|
} |
|
10
|
|
|
|
|
11
|
|
|
/** |
|
12
|
|
|
* Return the senders that have tried to use this account. |
|
13
|
|
|
* @return array an array of sender data, one for each sending addresses used by the account |
|
14
|
|
|
* - return[] struct the information on each sending address in the account |
|
15
|
|
|
* - address string the sender's email address |
|
16
|
|
|
* - 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 |
|
17
|
|
|
* - sent integer the total number of messages sent by this sender |
|
18
|
|
|
* - hard_bounces integer the total number of hard bounces by messages by this sender |
|
19
|
|
|
* - soft_bounces integer the total number of soft bounces by messages by this sender |
|
20
|
|
|
* - rejects integer the total number of rejected messages by this sender |
|
21
|
|
|
* - complaints integer the total number of spam complaints received for messages by this sender |
|
22
|
|
|
* - unsubs integer the total number of unsubscribe requests received for messages by this sender |
|
23
|
|
|
* - opens integer the total number of times messages by this sender have been opened |
|
24
|
|
|
* - clicks integer the total number of times tracked URLs in messages by this sender have been clicked |
|
25
|
|
|
* - unique_opens integer the number of unique opens for emails sent for this sender |
|
26
|
|
|
* - unique_clicks integer the number of unique clicks for emails sent for this sender |
|
27
|
|
|
*/ |
|
28
|
|
|
public function getList() |
|
29
|
|
|
{ |
|
30
|
|
|
$_params = array(); |
|
31
|
|
|
return $this->master->call('senders/list', $_params); |
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* Returns the sender domains that have been added to this account. |
|
36
|
|
|
* @return array an array of sender domain data, one for each sending domain used by the account |
|
37
|
|
|
* - return[] struct the information on each sending domain for the account |
|
38
|
|
|
* - domain string the sender domain name |
|
39
|
|
|
* - created_at string the date and time that the sending domain was first seen as a UTC string in YYYY-MM-DD HH:MM:SS format |
|
40
|
|
|
* - last_tested_at string when the domain's DNS settings were last tested as a UTC string in YYYY-MM-DD HH:MM:SS format |
|
41
|
|
|
* - spf struct details about the domain's SPF record |
|
42
|
|
|
* - valid boolean whether the domain's SPF record is valid for use with Mandrill |
|
43
|
|
|
* - valid_after string when the domain's SPF record will be considered valid for use with Mandrill as a UTC string in YYYY-MM-DD HH:MM:SS format. If set, this indicates that the record is valid now, but was previously invalid, and Mandrill will wait until the record's TTL elapses to start using it. |
|
44
|
|
|
* - error string an error describing the spf record, or null if the record is correct |
|
45
|
|
|
* - dkim struct details about the domain's DKIM record |
|
46
|
|
|
* - valid boolean whether the domain's DKIM record is valid for use with Mandrill |
|
47
|
|
|
* - valid_after string when the domain's DKIM record will be considered valid for use with Mandrill as a UTC string in YYYY-MM-DD HH:MM:SS format. If set, this indicates that the record is valid now, but was previously invalid, and Mandrill will wait until the record's TTL elapses to start using it. |
|
48
|
|
|
* - error string an error describing the DKIM record, or null if the record is correct |
|
49
|
|
|
* - verified_at string if the domain has been verified, this indicates when that verification occurred as a UTC string in YYYY-MM-DD HH:MM:SS format |
|
50
|
|
|
* - valid_signing boolean whether this domain can be used to authenticate mail, either for itself or as a custom signing domain. If this is false but spf and dkim are both valid, you will need to verify the domain before using it to authenticate mail |
|
51
|
|
|
*/ |
|
52
|
|
|
public function domains() |
|
53
|
|
|
{ |
|
54
|
|
|
$_params = array(); |
|
55
|
|
|
return $this->master->call('senders/domains', $_params); |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
/** |
|
59
|
|
|
* Adds a sender domain to your account. Sender domains are added automatically as you |
|
60
|
|
|
send, but you can use this call to add them ahead of time. |
|
61
|
|
|
* @param string $domain a domain name |
|
62
|
|
|
* @return struct information about the domain |
|
|
|
|
|
|
63
|
|
|
* - domain string the sender domain name |
|
64
|
|
|
* - created_at string the date and time that the sending domain was first seen as a UTC string in YYYY-MM-DD HH:MM:SS format |
|
65
|
|
|
* - last_tested_at string when the domain's DNS settings were last tested as a UTC string in YYYY-MM-DD HH:MM:SS format |
|
66
|
|
|
* - spf struct details about the domain's SPF record |
|
67
|
|
|
* - valid boolean whether the domain's SPF record is valid for use with Mandrill |
|
68
|
|
|
* - valid_after string when the domain's SPF record will be considered valid for use with Mandrill as a UTC string in YYYY-MM-DD HH:MM:SS format. If set, this indicates that the record is valid now, but was previously invalid, and Mandrill will wait until the record's TTL elapses to start using it. |
|
69
|
|
|
* - error string an error describing the spf record, or null if the record is correct |
|
70
|
|
|
* - dkim struct details about the domain's DKIM record |
|
71
|
|
|
* - valid boolean whether the domain's DKIM record is valid for use with Mandrill |
|
72
|
|
|
* - valid_after string when the domain's DKIM record will be considered valid for use with Mandrill as a UTC string in YYYY-MM-DD HH:MM:SS format. If set, this indicates that the record is valid now, but was previously invalid, and Mandrill will wait until the record's TTL elapses to start using it. |
|
73
|
|
|
* - error string an error describing the DKIM record, or null if the record is correct |
|
74
|
|
|
* - verified_at string if the domain has been verified, this indicates when that verification occurred as a UTC string in YYYY-MM-DD HH:MM:SS format |
|
75
|
|
|
* - valid_signing boolean whether this domain can be used to authenticate mail, either for itself or as a custom signing domain. If this is false but spf and dkim are both valid, you will need to verify the domain before using it to authenticate mail |
|
76
|
|
|
*/ |
|
77
|
|
|
public function addDomain($domain) |
|
78
|
|
|
{ |
|
79
|
|
|
$_params = array("domain" => $domain); |
|
80
|
|
|
return $this->master->call('senders/add-domain', $_params); |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
/** |
|
84
|
|
|
* Checks the SPF and DKIM settings for a domain. If you haven't already added this domain to your |
|
85
|
|
|
account, it will be added automatically. |
|
86
|
|
|
* @param string $domain a domain name |
|
87
|
|
|
* @return struct information about the sender domain |
|
88
|
|
|
* - domain string the sender domain name |
|
89
|
|
|
* - created_at string the date and time that the sending domain was first seen as a UTC string in YYYY-MM-DD HH:MM:SS format |
|
90
|
|
|
* - last_tested_at string when the domain's DNS settings were last tested as a UTC string in YYYY-MM-DD HH:MM:SS format |
|
91
|
|
|
* - spf struct details about the domain's SPF record |
|
92
|
|
|
* - valid boolean whether the domain's SPF record is valid for use with Mandrill |
|
93
|
|
|
* - valid_after string when the domain's SPF record will be considered valid for use with Mandrill as a UTC string in YYYY-MM-DD HH:MM:SS format. If set, this indicates that the record is valid now, but was previously invalid, and Mandrill will wait until the record's TTL elapses to start using it. |
|
94
|
|
|
* - error string an error describing the spf record, or null if the record is correct |
|
95
|
|
|
* - dkim struct details about the domain's DKIM record |
|
96
|
|
|
* - valid boolean whether the domain's DKIM record is valid for use with Mandrill |
|
97
|
|
|
* - valid_after string when the domain's DKIM record will be considered valid for use with Mandrill as a UTC string in YYYY-MM-DD HH:MM:SS format. If set, this indicates that the record is valid now, but was previously invalid, and Mandrill will wait until the record's TTL elapses to start using it. |
|
98
|
|
|
* - error string an error describing the DKIM record, or null if the record is correct |
|
99
|
|
|
* - verified_at string if the domain has been verified, this indicates when that verification occurred as a UTC string in YYYY-MM-DD HH:MM:SS format |
|
100
|
|
|
* - valid_signing boolean whether this domain can be used to authenticate mail, either for itself or as a custom signing domain. If this is false but spf and dkim are both valid, you will need to verify the domain before using it to authenticate mail |
|
101
|
|
|
*/ |
|
102
|
|
|
public function checkDomain($domain) |
|
103
|
|
|
{ |
|
104
|
|
|
$_params = array("domain" => $domain); |
|
105
|
|
|
return $this->master->call('senders/check-domain', $_params); |
|
106
|
|
|
} |
|
107
|
|
|
|
|
108
|
|
|
/** |
|
109
|
|
|
* Sends a verification email in order to verify ownership of a domain. |
|
110
|
|
|
Domain verification is an optional step to confirm ownership of a domain. Once a |
|
111
|
|
|
domain has been verified in a Mandrill account, other accounts may not have their |
|
112
|
|
|
messages signed by that domain unless they also verify the domain. This prevents |
|
113
|
|
|
other Mandrill accounts from sending mail signed by your domain. |
|
114
|
|
|
* @param string $domain a domain name at which you can receive email |
|
115
|
|
|
* @param string $mailbox a mailbox at the domain where the verification email should be sent |
|
116
|
|
|
* @return struct information about the verification that was sent |
|
117
|
|
|
* - status string "sent" indicates that the verification has been sent, "already_verified" indicates that the domain has already been verified with your account |
|
118
|
|
|
* - domain string the domain name you provided |
|
119
|
|
|
* - email string the email address the verification email was sent to |
|
120
|
|
|
*/ |
|
121
|
|
|
public function verifyDomain($domain, $mailbox) |
|
122
|
|
|
{ |
|
123
|
|
|
$_params = array("domain" => $domain, "mailbox" => $mailbox); |
|
124
|
|
|
return $this->master->call('senders/verify-domain', $_params); |
|
125
|
|
|
} |
|
126
|
|
|
|
|
127
|
|
|
/** |
|
128
|
|
|
* Return more detailed information about a single sender, including aggregates of recent stats |
|
129
|
|
|
* @param string $address the email address of the sender |
|
130
|
|
|
* @return struct the detailed information on the sender |
|
131
|
|
|
* - address string the sender's email address |
|
132
|
|
|
* - 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 |
|
133
|
|
|
* - sent integer the total number of messages sent by this sender |
|
134
|
|
|
* - hard_bounces integer the total number of hard bounces by messages by this sender |
|
135
|
|
|
* - soft_bounces integer the total number of soft bounces by messages by this sender |
|
136
|
|
|
* - rejects integer the total number of rejected messages by this sender |
|
137
|
|
|
* - complaints integer the total number of spam complaints received for messages by this sender |
|
138
|
|
|
* - unsubs integer the total number of unsubscribe requests received for messages by this sender |
|
139
|
|
|
* - opens integer the total number of times messages by this sender have been opened |
|
140
|
|
|
* - clicks integer the total number of times tracked URLs in messages by this sender have been clicked |
|
141
|
|
|
* - stats struct an aggregate summary of the sender's sending stats |
|
142
|
|
|
* - today struct stats for this sender so far today |
|
143
|
|
|
* - sent integer the number of emails sent for this sender so far today |
|
144
|
|
|
* - hard_bounces integer the number of emails hard bounced for this sender so far today |
|
145
|
|
|
* - soft_bounces integer the number of emails soft bounced for this sender so far today |
|
146
|
|
|
* - rejects integer the number of emails rejected for sending this sender so far today |
|
147
|
|
|
* - complaints integer the number of spam complaints for this sender so far today |
|
148
|
|
|
* - unsubs integer the number of unsubscribes for this sender so far today |
|
149
|
|
|
* - opens integer the number of times emails have been opened for this sender so far today |
|
150
|
|
|
* - unique_opens integer the number of unique opens for emails sent for this sender so far today |
|
151
|
|
|
* - clicks integer the number of URLs that have been clicked for this sender so far today |
|
152
|
|
|
* - unique_clicks integer the number of unique clicks for emails sent for this sender so far today |
|
153
|
|
|
* - last_7_days struct stats for this sender in the last 7 days |
|
154
|
|
|
* - sent integer the number of emails sent for this sender in the last 7 days |
|
155
|
|
|
* - hard_bounces integer the number of emails hard bounced for this sender in the last 7 days |
|
156
|
|
|
* - soft_bounces integer the number of emails soft bounced for this sender in the last 7 days |
|
157
|
|
|
* - rejects integer the number of emails rejected for sending this sender in the last 7 days |
|
158
|
|
|
* - complaints integer the number of spam complaints for this sender in the last 7 days |
|
159
|
|
|
* - unsubs integer the number of unsubscribes for this sender in the last 7 days |
|
160
|
|
|
* - opens integer the number of times emails have been opened for this sender in the last 7 days |
|
161
|
|
|
* - unique_opens integer the number of unique opens for emails sent for this sender in the last 7 days |
|
162
|
|
|
* - clicks integer the number of URLs that have been clicked for this sender in the last 7 days |
|
163
|
|
|
* - unique_clicks integer the number of unique clicks for emails sent for this sender in the last 7 days |
|
164
|
|
|
* - last_30_days struct stats for this sender in the last 30 days |
|
165
|
|
|
* - sent integer the number of emails sent for this sender in the last 30 days |
|
166
|
|
|
* - hard_bounces integer the number of emails hard bounced for this sender in the last 30 days |
|
167
|
|
|
* - soft_bounces integer the number of emails soft bounced for this sender in the last 30 days |
|
168
|
|
|
* - rejects integer the number of emails rejected for sending this sender in the last 30 days |
|
169
|
|
|
* - complaints integer the number of spam complaints for this sender in the last 30 days |
|
170
|
|
|
* - unsubs integer the number of unsubscribes for this sender in the last 30 days |
|
171
|
|
|
* - opens integer the number of times emails have been opened for this sender in the last 30 days |
|
172
|
|
|
* - unique_opens integer the number of unique opens for emails sent for this sender in the last 30 days |
|
173
|
|
|
* - clicks integer the number of URLs that have been clicked for this sender in the last 30 days |
|
174
|
|
|
* - unique_clicks integer the number of unique clicks for emails sent for this sender in the last 30 days |
|
175
|
|
|
* - last_60_days struct stats for this sender in the last 60 days |
|
176
|
|
|
* - sent integer the number of emails sent for this sender in the last 60 days |
|
177
|
|
|
* - hard_bounces integer the number of emails hard bounced for this sender in the last 60 days |
|
178
|
|
|
* - soft_bounces integer the number of emails soft bounced for this sender in the last 60 days |
|
179
|
|
|
* - rejects integer the number of emails rejected for sending this sender in the last 60 days |
|
180
|
|
|
* - complaints integer the number of spam complaints for this sender in the last 60 days |
|
181
|
|
|
* - unsubs integer the number of unsubscribes for this sender in the last 60 days |
|
182
|
|
|
* - opens integer the number of times emails have been opened for this sender in the last 60 days |
|
183
|
|
|
* - unique_opens integer the number of unique opens for emails sent for this sender in the last 60 days |
|
184
|
|
|
* - clicks integer the number of URLs that have been clicked for this sender in the last 60 days |
|
185
|
|
|
* - unique_clicks integer the number of unique clicks for emails sent for this sender in the last 60 days |
|
186
|
|
|
* - last_90_days struct stats for this sender in the last 90 days |
|
187
|
|
|
* - sent integer the number of emails sent for this sender in the last 90 days |
|
188
|
|
|
* - hard_bounces integer the number of emails hard bounced for this sender in the last 90 days |
|
189
|
|
|
* - soft_bounces integer the number of emails soft bounced for this sender in the last 90 days |
|
190
|
|
|
* - rejects integer the number of emails rejected for sending this sender in the last 90 days |
|
191
|
|
|
* - complaints integer the number of spam complaints for this sender in the last 90 days |
|
192
|
|
|
* - unsubs integer the number of unsubscribes for this sender in the last 90 days |
|
193
|
|
|
* - opens integer the number of times emails have been opened for this sender in the last 90 days |
|
194
|
|
|
* - unique_opens integer the number of unique opens for emails sent for this sender in the last 90 days |
|
195
|
|
|
* - clicks integer the number of URLs that have been clicked for this sender in the last 90 days |
|
196
|
|
|
* - unique_clicks integer the number of unique clicks for emails sent for this sender in the last 90 days |
|
197
|
|
|
*/ |
|
198
|
|
|
public function info($address) |
|
199
|
|
|
{ |
|
200
|
|
|
$_params = array("address" => $address); |
|
201
|
|
|
return $this->master->call('senders/info', $_params); |
|
202
|
|
|
} |
|
203
|
|
|
|
|
204
|
|
|
/** |
|
205
|
|
|
* Return the recent history (hourly stats for the last 30 days) for a sender |
|
206
|
|
|
* @param string $address the email address of the sender |
|
207
|
|
|
* @return array the array of history information |
|
208
|
|
|
* - return[] struct the stats for a single hour |
|
209
|
|
|
* - time string the hour as a UTC date string in YYYY-MM-DD HH:MM:SS format |
|
210
|
|
|
* - sent integer the number of emails that were sent during the hour |
|
211
|
|
|
* - hard_bounces integer the number of emails that hard bounced during the hour |
|
212
|
|
|
* - soft_bounces integer the number of emails that soft bounced during the hour |
|
213
|
|
|
* - rejects integer the number of emails that were rejected during the hour |
|
214
|
|
|
* - complaints integer the number of spam complaints received during the hour |
|
215
|
|
|
* - opens integer the number of emails opened during the hour |
|
216
|
|
|
* - unique_opens integer the number of unique opens generated by messages sent during the hour |
|
217
|
|
|
* - clicks integer the number of tracked URLs clicked during the hour |
|
218
|
|
|
* - unique_clicks integer the number of unique clicks generated by messages sent during the hour |
|
219
|
|
|
*/ |
|
220
|
|
|
public function timeSeries($address) |
|
221
|
|
|
{ |
|
222
|
|
|
$_params = array("address" => $address); |
|
223
|
|
|
return $this->master->call('senders/time-series', $_params); |
|
224
|
|
|
} |
|
225
|
|
|
} |
|
226
|
|
|
|