1: <?php
2:
3: class Mandrill_Inbound {
4: public function __construct(Mandrill $master) {
5: $this->master = $master;
6: }
7:
8: /**
9: * List the domains that have been configured for inbound delivery
10: * @return array the inbound domains associated with the account
11: * - return[] struct the individual domain info
12: * - domain string the domain name that is accepting mail
13: * - created_at string the date and time that the inbound domain was added as a UTC string in YYYY-MM-DD HH:MM:SS format
14: * - valid_mx boolean true if this inbound domain has successfully set up an MX record to deliver mail to the Mandrill servers
15: */
16: public function domains() {
17: $_params = array();
18: return $this->master->call('inbound/domains', $_params);
19: }
20:
21: /**
22: * List the mailbox routes defined for an inbound domain
23: * @param string $domain the domain to check
24: * @return array the routes associated with the domain
25: * - return[] struct the individual mailbox route
26: * - pattern string the search pattern that the mailbox name should match
27: * - url string the webhook URL where inbound messages will be published
28: */
29: public function routes($domain) {
30: $_params = array("domain" => $domain);
31: return $this->master->call('inbound/routes', $_params);
32: }
33:
34: /**
35: * Take a raw MIME document destined for a domain with inbound domains set up, and send it to the inbound hook exactly as if it had been sent over SMTP
36: * @param string $raw_message the full MIME document of an email message
37: * @param array|null $to optionally define the recipients to receive the message - otherwise we'll use the To, Cc, and Bcc headers provided in the document
38: * - to[] string the email address of the recipient
39: * @param string $mail_from the address specified in the MAIL FROM stage of the SMTP conversation. Required for the SPF check.
40: * @param string $helo the identification provided by the client mta in the MTA state of the SMTP conversation. Required for the SPF check.
41: * @param string $client_address the remote MTA's ip address. Optional; required for the SPF check.
42: * @return array an array of the information for each recipient in the message (usually one) that matched an inbound route
43: * - return[] struct the individual recipient information
44: * - email string the email address of the matching recipient
45: * - pattern string the mailbox route pattern that the recipient matched
46: * - url string the webhook URL that the message was posted to
47: */
48: public function sendRaw($raw_message, $to=null, $mail_from=null, $helo=null, $client_address=null) {
49: $_params = array("raw_message" => $raw_message, "to" => $to, "mail_from" => $mail_from, "helo" => $helo, "client_address" => $client_address);
50: return $this->master->call('inbound/send-raw', $_params);
51: }
52:
53: }
54:
55:
56: