Instead of making a POST request, you should include the Mandrill API in the <script> in the <head> :
<script type="text/javascript" src="path_to_locally_stored_copy_of_mandrill_API"></script>
Then you can access it in your JS file:
var m = new mandrill.Mandrill('your_api_key'); // This will be public function sendTheMail(){ m.messages.send({ "message": { "from_email": "your_email_address", "from_name": "your_name", "to":[{"email": "someone's_email_address", "name": "someone's_name"}], // Array of recipients "subject": "optional_subject_line", "text": "Text to be sent in the body" // Alternatively, use the "html" key to send HTML emails rather than plaintext } }); }
However, note that this will open your API to the public , as it will be accessible from the client side using dev tools. This could open up phishing vulnerabilities and someone could abuse your key.
I will also review the full Mandrill documents for send .
source share