dart

Choose Language

Whitelists Calls

/whitelists/add.json

Adds an email to your email rejection whitelist. If the address is currently on your blacklist, that blacklist entry will be removed automatically.

Example Call

var mandrill = new Mandrill('YOUR_API_KEY'); var email = "email@example.com"; var comment = "Internal support address"; mandrill.whitelists.add(email, comment).then((result) { print(result); /* { "email": "example email", "added": 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
email* string an email address to add to the whitelist
Validation: email
comment string an optional description of why the email was whitelisted
Validation: maxlength(255)
Return Value
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
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.

/whitelists/list.json

Retrieves your email rejection whitelist. You can provide an email address or search prefix to limit the results. Returns up to 1000 results.

Example Call

var mandrill = new Mandrill('YOUR_API_KEY'); var email = "example email"; mandrill.whitelists.list(email).then((result) { print(result); /* [{ "email": "example email", "detail": "Whitelisted internal address", "created_at": "2013-01-01 15:30:32" }] */ }).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
email string an optional email address or prefix to search by
Return Value
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
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.

/whitelists/delete.json

Removes an email address from the whitelist.

Example Call

var mandrill = new Mandrill('YOUR_API_KEY'); var email = "email@example.com"; mandrill.whitelists.delete(email).then((result) { print(result); /* { "email": "email@example.com", "deleted": 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
email* string the email address to remove from the whitelist
Validation: required, email
Return Value
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
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.