beginners guide to mandrill
TRANSCRIPT
![Page 1: Beginners guide to Mandrill](https://reader035.vdocuments.site/reader035/viewer/2022062407/55d11120bb61eb29508b45db/html5/thumbnails/1.jpg)
Beginners Guide to Mandrill
![Page 2: Beginners guide to Mandrill](https://reader035.vdocuments.site/reader035/viewer/2022062407/55d11120bb61eb29508b45db/html5/thumbnails/2.jpg)
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.
![Page 3: Beginners guide to Mandrill](https://reader035.vdocuments.site/reader035/viewer/2022062407/55d11120bb61eb29508b45db/html5/thumbnails/3.jpg)
Points How to Get Started with Mandrill? SMTP Integration. Delivery and Authentication. API Integration. Inbound Email Processing. Webhooks. Reputation and Hourly Quota.
![Page 4: Beginners guide to Mandrill](https://reader035.vdocuments.site/reader035/viewer/2022062407/55d11120bb61eb29508b45db/html5/thumbnails/4.jpg)
Get Started
Create a Mandrill AccountTo get started, you'll want to create a new Mandrill account here: http://mandrill.com/signup/
Set Up Sending DomainsOnce 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
![Page 5: Beginners guide to Mandrill](https://reader035.vdocuments.site/reader035/viewer/2022062407/55d11120bb61eb29508b45db/html5/thumbnails/5.jpg)
SMTP IntegrationFind 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.
![Page 6: Beginners guide to Mandrill](https://reader035.vdocuments.site/reader035/viewer/2022062407/55d11120bb61eb29508b45db/html5/thumbnails/6.jpg)
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
![Page 7: Beginners guide to Mandrill](https://reader035.vdocuments.site/reader035/viewer/2022062407/55d11120bb61eb29508b45db/html5/thumbnails/7.jpg)
Email Delivery & AuthenticationEmail 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 DomainsAdd 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 information3.Click the Test DNS Settings button to check and verify the DNS settings for our sending domain.
![Page 8: Beginners guide to Mandrill](https://reader035.vdocuments.site/reader035/viewer/2022062407/55d11120bb61eb29508b45db/html5/thumbnails/8.jpg)
API IntegrationMandrill has official API clients/wrappers for the following languages:Ruby, Python, NodeJS, JavaScript and PHP.
Third-Party API WrappersThere 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)
![Page 9: Beginners guide to Mandrill](https://reader035.vdocuments.site/reader035/viewer/2022062407/55d11120bb61eb29508b45db/html5/thumbnails/9.jpg)
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.
![Page 10: Beginners guide to Mandrill](https://reader035.vdocuments.site/reader035/viewer/2022062407/55d11120bb61eb29508b45db/html5/thumbnails/10.jpg)
Mandrill PHP API IntegrationRequirementsPHP 5.2.x or higherPHP cURL extension
Install via composer curl -s http://getcomposer.org/installer | php Create composer.json { "require": { "mandrill/mandrill": "1.0.*" } } Install dependency: php composer.phar install
![Page 11: Beginners guide to Mandrill](https://reader035.vdocuments.site/reader035/viewer/2022062407/55d11120bb61eb29508b45db/html5/thumbnails/11.jpg)
Using the LibraryMandrill 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'); ?>
![Page 12: Beginners guide to Mandrill](https://reader035.vdocuments.site/reader035/viewer/2022062407/55d11120bb61eb29508b45db/html5/thumbnails/12.jpg)
API CallsMandrill API calls are described in the following linkhttps://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
![Page 13: Beginners guide to Mandrill](https://reader035.vdocuments.site/reader035/viewer/2022062407/55d11120bb61eb29508b45db/html5/thumbnails/13.jpg)
Example Message Call$mandrill = new Mandrill('YOUR_API_KEY'); $message = array( 'html' => '<p>Example HTML content</p>',
'text' => 'Example text content', 'subject' => 'example subject', 'from_email' => '[email protected]', 'from_name' => 'Example Name', 'to' => array( array( 'email' => '[email protected]', 'name' => 'Recipient
Name', 'type' => 'to' ) ), 'headers' => array('Reply-To' => '[email protected]'), 'important' => false, 'track_opens' => null, 'track_clicks' => null, 'bcc_address' => '[email protected]', 'signing_domain' => null, 'tags' => array('password-resets'), 'subaccount' => 'customer-123', 'google_analytics_domains' => array('example.com'),
'attachments' => array( array( 'type' => 'text/plain', 'name' => 'myfile.txt', 'content' => 'ZXhhbXBsZSBmaWxl' ) ),'images' => array( array( 'type' => 'image/png', 'name' => 'IMAGECID', 'content' => 'ZXhhbXBsZSBmaWxl' ) ) ); $async = false; $ip_pool = false;$send_at = false; //UTC timestamp in YYYY-MM-DD HH:MM:SS$result = $mandrill->messages->send($message, $async, $ip_pool, $send_at);
![Page 14: Beginners guide to Mandrill](https://reader035.vdocuments.site/reader035/viewer/2022062407/55d11120bb61eb29508b45db/html5/thumbnails/14.jpg)
print_r($result);
Array ( [0] => Array ( [email] => [email protected] [status] => sent [reject_reason] => hard-bounce [_id] => abc123abc123abc123abc123))
![Page 15: Beginners guide to Mandrill](https://reader035.vdocuments.site/reader035/viewer/2022062407/55d11120bb61eb29508b45db/html5/thumbnails/15.jpg)
Inbound Email Processing Set Up an Inbound Domain Add a Route Test Inbound Webhooks Inbound Events Format
![Page 16: Beginners guide to Mandrill](https://reader035.vdocuments.site/reader035/viewer/2022062407/55d11120bb61eb29508b45db/html5/thumbnails/16.jpg)
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.
![Page 17: Beginners guide to Mandrill](https://reader035.vdocuments.site/reader035/viewer/2022062407/55d11120bb61eb29508b45db/html5/thumbnails/17.jpg)
Add a RouteA route defines the local part (everything before the @ symbol) of the email
address(es) where you’ll receive mail.
![Page 18: Beginners guide to Mandrill](https://reader035.vdocuments.site/reader035/viewer/2022062407/55d11120bb61eb29508b45db/html5/thumbnails/18.jpg)
Inbound Events Format
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
![Page 19: Beginners guide to Mandrill](https://reader035.vdocuments.site/reader035/viewer/2022062407/55d11120bb61eb29508b45db/html5/thumbnails/19.jpg)
WebhooksMandrill's webhooks allow our application to receive information about
email events as they occur. See the screenshot attached:
![Page 20: Beginners guide to Mandrill](https://reader035.vdocuments.site/reader035/viewer/2022062407/55d11120bb61eb29508b45db/html5/thumbnails/20.jpg)
![Page 21: Beginners guide to Mandrill](https://reader035.vdocuments.site/reader035/viewer/2022062407/55d11120bb61eb29508b45db/html5/thumbnails/21.jpg)
Other ConsiderationsSending quotaEach 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 limitsMessages should be 25MB in size or less.
AttachmentsYou 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.
![Page 22: Beginners guide to Mandrill](https://reader035.vdocuments.site/reader035/viewer/2022062407/55d11120bb61eb29508b45db/html5/thumbnails/22.jpg)
Thanks