2. What Is Mandrill?
Mandrill is designed to help applications or
websites that need to send transactional email
like password resets, order confirmations,
notifications and welcome messages.
Technically, you can send any legal, non-spam
emails through Mandrill.
3. Points
How to Get Started with Mandrill?
SMTP Integration.
Delivery and Authentication.
API Integration.
Inbound Email Processing.
Webhooks.
Reputation and Hourly Quota.
4. Get Started
Create a Mandrill Account
To get started, you'll want to create a new Mandrill account here:
http://mandrill.com/signup/
Set Up Sending Domains
Once you've SIGNED UP, one of the first things you'll want to do is set
up your sending domain(s).
• Sender Policy Framework (SPF) Record
• Domain Keys Identified Mail (DKIM) Record
5. SMTP Integration
Find our SMTP credentials on the SMTP & API Info in settings page.
The SMTP password is any active API key for your account, not the password
used to log in to Mandrill.
6. SPMTP Integration with PHP Mailer Class
$mail->Host = 'smtp.mandrillapp.com'; // Specify main and backup server
$mail->Port = 587; // Set the SMTP port
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'MANDRILL_USERNAME'; // SMTP username
$mail->Password = 'MANDRILL_APIKEY'; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable
7. Email Delivery & Authentication
Email can be easy to forge, so Mandrill automatically authenticates all emails
sent through their system using multiple authentication methods to help
improve deliverability.
Set Up Sending Domains
Add SPF and DKIM records to our sending domains to remove the 'on behalf
of' or 'via' information.
1.Add new sending domain under settings.
2.Click the View DKIM Settings and View SPF Settings links for more detailed
information
3.Click the Test DNS Settings button to check and verify the DNS settings for
our sending domain.
8. API Integration
Mandrill has official API clients/wrappers for the following languages:
Ruby, Python, NodeJS, JavaScript and PHP.
Third-Party API Wrappers
There is a list of known Mandrill API wrappers created by third parties for
different languages. In php, we can use
•https://github.com/kai5263499/mandrill-php
•https://github.com/darrenscerri/Mindrill
•https://github.com/MichMich/laravel-mandrill (LaravelPHP)
9. API Endpoint
All API URLs are relative to
https://mandrillapp.com/api/1.0/.
For example, the /users/ping API call is reachable at
https://mandrillapp.com/api/1.0/users/ping.json.
11. Using the Library
Mandrill API start by including the library and instantiating the Mandrill class.
<?php
require_once 'mandrill-api-php/src/Mandrill.php'; //Not required with Composer
$mandrill = new Mandrill('YOUR_API_KEY');
?>
12. API Calls
Mandrill API calls are described in the following link
https://mandrillapp.com/api/docs/index.php.html
Users Calls
Messages Calls
Tags Calls
Rejects Calls
Whitelists Calls
Senders Calls
Urls Calls
Templates Calls
Webhooks Calls
Subaccounts Calls
Inbound Calls
Exports Calls
Ips Calls
Metadata Calls
15. Inbound Email Processing
Set Up an Inbound Domain
Add a Route
Test Inbound Webhooks
Inbound Events Format
16. Set up an inbound domain
Go to Inbound in your Mandrill account.
Add the domain or subdomain name where you’ll receive mail and click the
+ Add New Inbound Domain button.
Click the DNS Settings button for any domain you’ve added to get the DNS
records you’ll need to add for your domain.
Test the records for your domain using the Test button. We’ll check the MX
records for the domain to be sure they’re configured properly.
17. Add a Route
A route defines the local part (everything before the @ symbol) of the email
address(es) where you’ll receive mail.
18. Inbound emails are processed based on the routes you’ve set up, and
messages matching the routes are sent to your specified URL(s) as a webhook.
The following link describes the message format:
https://mandrill.zendesk.com/hc/en-us/articles/205583197-Inbound-Email-Processing-Overview#inbound-
events-format
19. Mandrill's webhooks allow our application to receive information about
email events as they occur. See the screenshot attached:
20.
21. Other Considerations
Sending quota
Each account has an hourly sending quota based on the account reputation
and typical volume of email. When you first get started, since you have an
unknown reputation, the quota is very low but will quickly increase as you
start sending.
Size limits
Messages should be 25MB in size or less.
Attachments
You can include any type of attachment, including inline images. Messages
with attachments will be queued and all attachments run through a series of
virus scanning engines.