I am very glad that I asked my first question about StackOverflow. I relied on this to teach me a lot over the years!
My question is that. I get the following error when trying to send mail through the Mandrill API:
{"status":"error","code":-1,"name":"ValidationError","message":"You must specify a key value"}
The following code is what I use to try to send mail:
<?php $to = ' their@email.com '; $content = '<p>this is the emails html <a href="www.google.co.uk">content</a></p>'; $subject = 'this is the subject'; $from = ' my@email.com '; $uri = 'https://mandrillapp.com/api/1.0/messages/send.json'; $content_text = strip_tags($content); $postString = '{ "key": "RR_3yTMxxxxxxxx_Pa7gQ", "message": { "html": "' . $content . '", "text": "' . $content_text . '", "subject": "' . $subject . '", "from_email": "' . $from . '", "from_name": "' . $from . '", "to": [ { "email": "' . $to . '", "name": "' . $to . '" } ], "track_opens": true, "track_clicks": true, "auto_text": true, "url_strip_qs": true, "preserve_recipients": true }, "async": false }'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $uri); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true ); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $postString); $result = curl_exec($ch); echo $result; ?>
Which may cause a verification error in the message. I provide my API key and it is valid!
Hope someone can help, and thanks for being generally AWESOME here!
Thanks!