PHP code example of lekoala / silverstripe-mailgun
1. Go to this page and download the library: Download lekoala/silverstripe-mailgun library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
lekoala / silverstripe-mailgun example snippets
MailgunHelper::registerTransport();
$email = new Email();
$email->setSubject($subject);
$email->setBody($body);
// Through Mandrill compat layer
$email->getSwiftMessage()->getHeaders()->addTextHeader('X-MC-Metadata', json_encode(['FIRST_NAME' => 'Jon Smith']));
// Or use Mailgun
$email->getSwiftMessage()->getHeaders()->addTextHeader('X-Mailgun-Variables', json_encode(['FIRST_NAME' => 'Jon Smith']));