dart

Choose Language

Inbound Calls

/inbound/domains.json

List the domains that have been configured for inbound delivery

Example Call

var mandrill = new Mandrill('YOUR_API_KEY'); mandrill.inbound.domains().then((result) { print(result); /* [{ "domain": "inbound.example.com", "created_at": "2013-01-01 15:30:27", "valid_mx": true }] */ }).catchError((e) { // Mandrill errors are thrown as exceptions print('A mandrill error occurred: ${e.runtimeType} - ${e.message}'); // A mandrill error occurred: Invalid_Key - Invalid API key });
Parameters
No parameters
Return Value
array the inbound domains associated with the account
return[] struct the individual domain info
domain string the domain name that is accepting mail
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
valid_mx boolean true if this inbound domain has successfully set up an MX record to deliver mail to the Mandrill servers
Errors
Invalid_Key The provided API key is not a valid Mandrill API key
ValidationError The parameters passed to the API call are invalid or not provided when required
GeneralError An unexpected error occurred processing the request. Mandrill developers will be notified.

/inbound/add-domain.json

Add an inbound domain to your account

Example Call

var mandrill = new Mandrill('YOUR_API_KEY'); var domain = "inbound.example.com"; mandrill.inbound.addDomain(domain).then((result) { print(result); /* { "domain": "inbound.example.com", "created_at": "2013-01-01 15:30:27", "valid_mx": true } */ }).catchError((e) { // Mandrill errors are thrown as exceptions print('A mandrill error occurred: ${e.runtimeType} - ${e.message}'); // A mandrill error occurred: Invalid_Key - Invalid API key });
Parameters
domain* string a domain name
Validation: strip_tags, required
Return Value
struct information about the domain
domain string the domain name that is accepting mail
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
valid_mx boolean true if this inbound domain has successfully set up an MX record to deliver mail to the Mandrill servers
Errors
Invalid_Key The provided API key is not a valid Mandrill API key
ValidationError The parameters passed to the API call are invalid or not provided when required
GeneralError An unexpected error occurred processing the request. Mandrill developers will be notified.

/inbound/check-domain.json

Check the MX settings for an inbound domain. The domain must have already been added with the add-domain call

Example Call

var mandrill = new Mandrill('YOUR_API_KEY'); var domain = "inbound.example.com"; mandrill.inbound.checkDomain(domain).then((result) { print(result); /* { "domain": "inbound.example.com", "created_at": "2013-01-01 15:30:27", "valid_mx": true } */ }).catchError((e) { // Mandrill errors are thrown as exceptions print('A mandrill error occurred: ${e.runtimeType} - ${e.message}'); // A mandrill error occurred: Unknown_InboundDomain - Unknown Inbound Domain: mandrill.com });
Parameters
domain* string an existing inbound domain
Return Value
struct information about the inbound domain
domain string the domain name that is accepting mail
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
valid_mx boolean true if this inbound domain has successfully set up an MX record to deliver mail to the Mandrill servers
Errors
Invalid_Key The provided API key is not a valid Mandrill API key
Unknown_InboundDomain The requested inbound domain does not exist
ValidationError The parameters passed to the API call are invalid or not provided when required
GeneralError An unexpected error occurred processing the request. Mandrill developers will be notified.

/inbound/delete-domain.json

Delete an inbound domain from the account. All mail will stop routing for this domain immediately.

Example Call

var mandrill = new Mandrill('YOUR_API_KEY'); var domain = "inbound.example.com"; mandrill.inbound.deleteDomain(domain).then((result) { print(result); /* { "domain": "inbound.example.com", "created_at": "2013-01-01 15:30:27", "valid_mx": true } */ }).catchError((e) { // Mandrill errors are thrown as exceptions print('A mandrill error occurred: ${e.runtimeType} - ${e.message}'); // A mandrill error occurred: Unknown_InboundDomain - Unknown Inbound Domain: mandrill.com });
Parameters
domain* string an existing inbound domain
Return Value
struct information about the deleted domain
domain string the domain name that is accepting mail
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
valid_mx boolean true if this inbound domain has successfully set up an MX record to deliver mail to the Mandrill servers
Errors
Invalid_Key The provided API key is not a valid Mandrill API key
Unknown_InboundDomain The requested inbound domain does not exist
ValidationError The parameters passed to the API call are invalid or not provided when required
GeneralError An unexpected error occurred processing the request. Mandrill developers will be notified.

/inbound/routes.json

List the mailbox routes defined for an inbound domain

Example Call

var mandrill = new Mandrill('YOUR_API_KEY'); var domain = "inbound.example.com"; mandrill.inbound.routes(domain).then((result) { print(result); /* [{ "id": "7.23", "pattern": "mailbox-*", "url": "http://example.com/webhook-url" }] */ }).catchError((e) { // Mandrill errors are thrown as exceptions print('A mandrill error occurred: ${e.runtimeType} - ${e.message}'); // A mandrill error occurred: Unknown_InboundDomain - Unknown Inbound Domain: mandrill.com });
Parameters
domain* string the domain to check
Validation: required
Return Value
array the routes associated with the domain
return[] struct the individual mailbox route
id string the unique identifier of the route
pattern string the search pattern that the mailbox name should match
url string the webhook URL where inbound messages will be published
Errors
Invalid_Key The provided API key is not a valid Mandrill API key
Unknown_InboundDomain The requested inbound domain does not exist
ValidationError The parameters passed to the API call are invalid or not provided when required
GeneralError An unexpected error occurred processing the request. Mandrill developers will be notified.

/inbound/add-route.json

Add a new mailbox route to an inbound domain

Example Call

var mandrill = new Mandrill('YOUR_API_KEY'); var domain = "inbound.example.com"; var pattern = "mailbox-*"; var url = "http://example.com/webhook-url"; mandrill.inbound.addRoute(domain, pattern, url).then((result) { print(result); /* { "id": "7.23", "pattern": "mailbox-*", "url": "http://example.com/webhook-url" } */ }).catchError((e) { // Mandrill errors are thrown as exceptions print('A mandrill error occurred: ${e.runtimeType} - ${e.message}'); // A mandrill error occurred: Unknown_InboundDomain - Unknown Inbound Domain: mandrill.com });
Parameters
domain* string an existing inbound domain
pattern* string the search pattern that the mailbox name should match
Validation: required
url* string the webhook URL where the inbound messages will be published
Validation: required, webhookexists
Return Value
struct the added mailbox route information
id string the unique identifier of the route
pattern string the search pattern that the mailbox name should match
url string the webhook URL where inbound messages will be published
Errors
Invalid_Key The provided API key is not a valid Mandrill API key
Unknown_InboundDomain The requested inbound domain does not exist
ValidationError The parameters passed to the API call are invalid or not provided when required
GeneralError An unexpected error occurred processing the request. Mandrill developers will be notified.

/inbound/update-route.json

Update the pattern or webhook of an existing inbound mailbox route. If null is provided for any fields, the values will remain unchanged.

Example Call

var mandrill = new Mandrill('YOUR_API_KEY'); var id = "7.23"; var pattern = "mailbox-*"; var url = "http://example.com/webhook-url"; mandrill.inbound.updateRoute(id, pattern, url).then((result) { print(result); /* { "id": "7.23", "pattern": "mailbox-*", "url": "http://example.com/webhook-url" } */ }).catchError((e) { // Mandrill errors are thrown as exceptions print('A mandrill error occurred: ${e.runtimeType} - ${e.message}'); // A mandrill error occurred: Unknown_InboundRoute - No route exists with the id '53.24' });
Parameters
id* string the unique identifier of an existing mailbox route
pattern string the search pattern that the mailbox name should match
url string the webhook URL where the inbound messages will be published
Validation: webhookexists
Return Value
struct the updated mailbox route information
id string the unique identifier of the route
pattern string the search pattern that the mailbox name should match
url string the webhook URL where inbound messages will be published
Errors
Invalid_Key The provided API key is not a valid Mandrill API key
Unknown_InboundRoute The provided inbound route does not exist.
ValidationError The parameters passed to the API call are invalid or not provided when required
GeneralError An unexpected error occurred processing the request. Mandrill developers will be notified.

/inbound/delete-route.json

Delete an existing inbound mailbox route

Example Call

var mandrill = new Mandrill('YOUR_API_KEY'); var id = "7.23"; mandrill.inbound.deleteRoute(id).then((result) { print(result); /* { "id": "7.23", "pattern": "mailbox-*", "url": "http://example.com/webhook-url" } */ }).catchError((e) { // Mandrill errors are thrown as exceptions print('A mandrill error occurred: ${e.runtimeType} - ${e.message}'); // A mandrill error occurred: Unknown_InboundRoute - No route exists with the id '53.24' });
Parameters
id* string the unique identifier of an existing route
Return Value
struct the deleted mailbox route information
id string the unique identifier of the route
pattern string the search pattern that the mailbox name should match
url string the webhook URL where inbound messages will be published
Errors
Invalid_Key The provided API key is not a valid Mandrill API key
Unknown_InboundRoute The provided inbound route does not exist.
ValidationError The parameters passed to the API call are invalid or not provided when required
GeneralError An unexpected error occurred processing the request. Mandrill developers will be notified.

/inbound/send-raw.json

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

Example Call

var mandrill = new Mandrill('YOUR_API_KEY'); var raw_message = "From: sender@example.com\nTo: mailbox-123@inbound.example.com\nSubject: Some Subject\n\nSome content."; var to = [ "mailbox-123@inbound.example.com" ]; var mail_from = "sender@example.com"; var helo = "example.com"; var client_address = "127.0.0.1"; mandrill.inbound.sendRaw(raw_message, to, mail_from, helo, client_address).then((result) { print(result); /* [{ "email": "mailbox-123@inbound.example.com", "pattern": "mailbox-*", "url": "http://example.com/webhook-url" }] */ }).catchError((e) { // Mandrill errors are thrown as exceptions print('A mandrill error occurred: ${e.runtimeType} - ${e.message}'); // A mandrill error occurred: Invalid_Key - Invalid API key });
Parameters
raw_message* string the full MIME document of an email message
Validation: required
to array|null optionally define the recipients to receive the message - otherwise we'll use the To, Cc, and Bcc headers provided in the document
to[] string the email address of the recipient
mail_from string the address specified in the MAIL FROM stage of the SMTP conversation. Required for the SPF check.
helo string the identification provided by the client mta in the MTA state of the SMTP conversation. Required for the SPF check.
client_address string the remote MTA's ip address. Optional; required for the SPF check.
Return Value
array an array of the information for each recipient in the message (usually one) that matched an inbound route
return[] struct the individual recipient information
email string the email address of the matching recipient
pattern string the mailbox route pattern that the recipient matched
url string the webhook URL that the message was posted to
Errors
Invalid_Key The provided API key is not a valid Mandrill API key
ValidationError The parameters passed to the API call are invalid or not provided when required
GeneralError An unexpected error occurred processing the request. Mandrill developers will be notified.