HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

More options, Mandrill integration

I'd like to see 2 things in a future release:

1) The ability to tweak the email that is sent via the dashboard (format, whether or not the message is included, if the message should be sent via plaintext or HTML, etc)

2) Built-in Mandrill integration. Enter your API key and adjust some settings, and the plugin will send via Mandrill instead of Vanilla's default mailer. This is essential for people who's host has a throttle on how many emails are sent per hour. I hacked together a workaround that replaces the "foreach ($Users as $User) block", feel free to expand on it and add a nice dashboard UI, etc:

foreach ($Users as $User) {
// compose message
$arguments = array('message' => array(
'html' => sprintf(
T($Story == '' ? 'EmailNotification' : 'EmailStoryNotification'),
$ActivityHeadline,
Url('/discussion/'.$DiscussionID.'/'.Gdn_Format::Url($DiscussionName), TRUE),
$Story
),
'subject' => sprintf(T('[%1$s] %2$s'), Gdn::Config('Garden.Title'), $ActivityHeadline),
'from_email' => 'YOUR-FROM-EMAIL-HERE',
'to' => array(array('email'=>$User[2])),
'track_opens'=> TRUE,
'track_clicks'=> TRUE
)
);

        // set endpoint
        $endpoint = 'https://mandrillapp.com/api/1.0/messages/send.json';

        // build payload
        $arguments['key'] = "YOUR-MANDRILL-API-KEY-HERE";

        // setup curl request
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $endpoint);
        curl_setopt($ch, CURLOPT_TIMEOUT, 30);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, true);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
        curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($arguments));
        $response = curl_exec($ch);
    }
Sign In or Register to comment.