public function __construct()
 {
     parent::__construct();
     $this->subject = _t('Member.SUBJECTPASSWORDRESET', "Your password reset link", 'Email subject');
     $viewer = new SSViewer('ForgotPasswordEmail');
     $this->body = $viewer;
 }
 public function __construct()
 {
     parent::__construct();
     $this->subject = _t('Member.SUBJECTPASSWORDCHANGED', "Your password has been changed", 'Email subject');
     $viewer = new SSViewer('ChangePasswordEmail');
     $this->body = $viewer;
 }
 public function actionDetails($id)
 {
     $model = MandrillEmail::model()->findByPk($id);
     if (!$model) {
         throw new CHttpException(404, 'Mandrill email [id: ' . $id . '] was not found');
     }
     $this->render('details', array());
 }
 public function __construct()
 {
     parent::__construct();
     $this->subject = _t('Member.SUBJECTPASSWORDCHANGED', "Your password has been changed", 'Email subject');
     $template = $this->config()->change_password_template;
     if (!$template) {
         $template = 'ChangePasswordEmail';
     }
     $viewer = new SSViewer($template);
     $this->body = $viewer;
 }
 public function __construct()
 {
     parent::__construct();
     $this->subject = _t('Member.SUBJECTPASSWORDRESET', "Your password reset link", 'Email subject');
     $template = $this->config()->forgot_password_template;
     if (!$template) {
         $template = 'ForgotPasswordEmail';
     }
     $viewer = new SSViewer($template);
     $this->body = $viewer;
 }
 private static function parseSentEvent($value)
 {
     if ($model = MandrillEmail::model()->findByPk($value['msg']['_id'])) {
         $model->status = MandrillEmail::STATUS_SENT;
         if (isset($value['msg']['metadata']['clientId']) && $value['msg']['metadata']['clientId']) {
             $model->clientId = $value['msg']['metadata']['clientId'];
             // not sure
         }
         return $model->save();
     }
     return false;
 }
 public function updateCMSFields(FieldList $fields)
 {
     $themes = MandrillEmail::getAvailableThemes();
     $fields->addFieldToTab('Root.Email', $html = new HtmlEditorField('EmailFooter', _t('MandrillSiteConfig.EmailFooter', 'Email Footer')));
     $html->setRows(5);
     $fields->addFieldToTab('Root.Email', $emailTheme = new DropdownField('EmailTheme', _t('MandrillSiteConfig.EmailTheme', 'Email Theme'), array_combine($themes, $themes)));
     $emailTheme->setEmptyString('');
     $fields->addFieldToTab('Root.Email', new TextField('DefaultFromEmail', _t('MandrillSiteConfig.DefaultFromEmail', 'Default From Email')));
     $fields->addFieldToTab('Root.Email', new TextField('DefaultToEmail', _t('MandrillSiteConfig.DefaultToEmail', 'Default To Email')));
     // form-extras integration
     $uploadClass = 'UploadField';
     if (class_exists('ImageUploadField')) {
         $uploadClass = 'ImageUploadField';
     }
     $fields->addFieldToTab('Root.Email', $emailLogo = new $uploadClass('EmailLogo', _t('MandrillSiteConfig.EmailLogo', 'Email Logo')));
     $emailLogo->setDescription(_t('MandrillSiteConfig.EmailLogoDesc', 'Will default to Logo if none defined'));
     return $fields;
 }
 public function run($request)
 {
     $config = SiteConfig::current_site_config();
     $default = Email::config()->admin_email;
     $default_config = $config->DefaultFromEmail;
     $member = Member::currentUser();
     $to = $request->getVar('email');
     $template = $request->getVar('template');
     $disabled = $request->getVar('disabled');
     if ($disabled) {
         MandrillMailer::setSendingDisabled();
     }
     if ($default) {
         echo "Default email address is {$default}<br/>";
     } else {
         echo "<div style='color:red'>Default email is not set. You should define one!</div>";
     }
     if ($default_config) {
         echo "Default email set in siteconfig is {$default_config}<br/>";
     }
     echo "The email will be sent to admin email, current member or an email passed in the url, like ?email=myemail@test.com<br/>";
     echo "A default email is used by default. You can use a preset template by setting ?template=mytemplate<br/>";
     echo "To prevent email from being sent, you can pass ?disabled=1<br/>";
     echo '<hr/>';
     if (!$default && $default_config) {
         $default = $default_config;
     }
     if (!$member && !$to) {
         if (!$default) {
             echo 'There are no recipient defined!';
             exit;
         } else {
             $to = $default;
         }
     }
     if ($template) {
         $emailTemplate = EmailTemplate::getByCode($template);
         $email = $emailTemplate->getEmail();
         $email->setSubject('Template ' . $template . ' from ' . $config->Title);
         $email->setSampleRequiredObjects();
     } else {
         $email = new MandrillEmail();
         $email->setSampleContent();
         $email->setSubject('Sample email from ' . $config->Title);
     }
     if (!$to) {
         $email->setToMember($member);
     } else {
         $member = Member::get()->filter('Email', $to)->first();
         if ($member) {
             $email->setToMember($member);
         } else {
             $email->setTo($to);
         }
     }
     echo 'Sending to ' . htmlentities($email->To()) . '<br/>';
     echo 'Using theme : ' . $email->getTheme() . '<br/>';
     echo '<hr/>';
     $res = $email->send();
     // Success!
     if ($res && is_array($res)) {
         echo '<div style="color:green">Successfully sent your email</div>';
         echo 'Recipient : ' . $res[0] . '<br/>';
         echo 'Additionnal headers : <br/>';
         foreach ($res[3] as $k => $v) {
             echo "{$k} : {$v}" . '<br/>';
         }
         echo 'Content : ' . $res[2];
     } else {
         echo '<div style="color:red">Failed to send email</div>';
         echo 'Error is : ' . MandrillMailer::getInstance()->getLastError();
     }
 }
 /**
  * Returns an instance of MandrillEmail with the content of the template
  * 
  * @return \MandrillEmail
  */
 public function getEmail()
 {
     $email = new MandrillEmail();
     if ($this->Template) {
         $email->setTemplate($this->Template);
     }
     if ($this->Theme) {
         $email->setTheme($this->Theme);
     }
     $email->setSubject($this->Title);
     $email->setBody($this->Content);
     if ($this->Callout) {
         $email->setCallout($this->Callout);
     }
     if ($this->SideBar) {
         $email->setSidebar($this->SideBar);
     }
     if ($this->ExtraModels) {
         $models = $this->getExtraModelsAsArray();
         $email->setRequiredObjects($models);
     }
     $email->setParseBody(true);
     return $email;
 }
	<div class="block-header">Search</div>
	<div class="content">
		<div class="control-group">
			<label class="control-label">Email</label>

			<div class="controls">
				<?php 
echo $form->textField($dataProviderModel, 'email');
?>
			</div>
		</div>

		<div class="control-group">
			<label class="control-label">Status</label>

			<div class="controls">
				<?php 
echo $form->checkBoxList($dataProviderModel, 'status', MandrillEmail::getStatuses(), ['separator' => ' ']);
?>
			</div>
		</div>

	</div>
</fieldset>
<?php 
$this->endWidget();
$this->widget('AdminGridView', array('dataProvider' => $dataProviderModel->search(), 'id' => 'email-list', 'columns' => array(array('class' => 'CButtonColumn', 'template' => '{details}', 'buttons' => array('details' => array('label' => 'Details', 'url' => function ($data) {
    return $this->createUrl('mail/details', ['id' => $data->id]);
}, 'imageUrl' => "/images/sys/admin/icons/edit-icon.png"))), 'status', array('value' => function (MandrillEmail $data) {
    return Date::formatDate('d/m/Y H:i', $data->sent);
}), 'email')));
 /**
  * @return mixed
  */
 public function send()
 {
     if (!$this->getOption(self::KEY_FROM_EMAIL)) {
         throw new Exception('cannot send message if Sender is not specified');
     }
     $apikey = Yii::app()->params['mandrill']['API_KEY'];
     if ($this->testRun) {
         $apikey = Yii::app()->params['mandrill']['TEST_API_KEY'];
     }
     $mandrill = new Mandrill($apikey);
     $this->message = $this->getMessage();
     $this->subject = $this->getOption(self::KEY_SUBJECT);
     $this->from = $this->getOption(self::KEY_FROM_EMAIL);
     $this->text = $this->getOption(self::KEY_HTML);
     $result = $mandrill->messages->send($this->message);
     $this->message = serialize($this->message);
     $r = $this->save(false);
     MandrillEmail::model()->queue($result, $this->id);
     return $r;
 }
Example #12
0
<?php

/**
 * Created by PhpStorm.
 * User: gabriel
 * Date: 1/6/16
 * Time: 4:38 PM
 */
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$username = mysql_real_escape_string($_POST['username']);
$password1 = $_POST['password1'];
$password2 = $_POST['password2'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$gender = $_POST['sex'];
print $username;
print $_POST['username'];
print $_POST['email'];
$key = md5($email);
echo isset($_POST['submit']);
echo $_POST['password1'];
$mail = new MandrillEmail();
$msg = 'This is to notify you that your email address has been used to create an admin account with us. Kindly go through
 the verification process or ignore if your mail was used without your consent.Thank you';
if ($mail->sendEmail($fname, $email, 'Welcome to eVoting', $msg)) {
    echo "sent";
} else {
    echo 'not sent';
}