Here I am going to explain you mandrill API setup and avoid your mail form spam folder.Please follow the below steps.

1) Create your account with mandrill.https://mandrillapp.com

2) Find out your API key.

3) Try to setup your API key in below code

<?php
require 'Mandrill.php';

try {
 $mandrill = new Mandrill('Your-API-KEY');
 $message = array(
 'html' => '<p>Example HTML content</p>',
 'text' => 'Example text content',
 'subject' => 'example subject',
 'from_email' => 'bhavesh561988@gmail.com',
 'from_name' => 'bhaveshkhanpara ',
 'to' => array(
 array(
 'email' => 'To@gmail.com',
 'name' => 'To Name',
 'type' => 'to'
 )
 ),
 'headers' => array('Reply-To' => 'reply@gmail.com')
 );
 $async = false;
 $result = $mandrill->messages->send($message, $async);
 print_r($result);
} catch(Mandrill_Error $e) {
 // Mandrill errors are thrown as exceptions
 echo 'A mandrill error occurred: ' . get_class($e) . ' - ' . $e->getMessage();
 // A mandrill error occurred: Mandrill_Unknown_Subaccount - No subaccount exists with the id 'customer-123'
 throw $e;
}
?>




For more details find the source code here https://github.com/bhavesh561988/mandrill

Advertisements