class TestingMandrillMailSystem in Mandrill 6
A mail sending implementation that captures sent messages to watchdog.
This class is for running tests or for development.
Hierarchy
- class \MandrillMailSystem
- class \TestingMandrillMailSystem
Expanded class hierarchy of TestingMandrillMailSystem
File
- ./
mandrill.mail.inc, line 147 - Class for sending mails via Mandrill.
View source
class TestingMandrillMailSystem extends MandrillMailSystem {
/**
* Accept an e-mail message and store it in a variable.
*
* @param $message
* An e-mail message.
*/
public function mail(array $message) {
if (!($from = variable_get('mandrill_from', ''))) {
drupal_set_message(t('Mandrill can\'t send email. Please !link.', array(
'!link' => l('add a verified from address', 'admin/settings/mandrill'),
)), 'error');
return FALSE;
}
$to = mandrill_get_to($message['to']);
watchdog('mandrill', 'Mandrill test email sent from %from to %to. Message: <pre>@message</pre>', array(
'%from' => $from,
'%to' => $to[0]['email'],
'@message' => print_r($message, TRUE),
), WATCHDOG_NOTICE);
drupal_set_message(t('Mandrill test email sent from %from to %to.', array(
'%from' => $from,
'%to' => $to[0]['email'],
)), 'notice');
return TRUE;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
MandrillMailSystem:: |
public | function | Concatenate and wrap the email body for either plain-text or HTML emails. | |
TestingMandrillMailSystem:: |
public | function |
Accept an e-mail message and store it in a variable. Overrides MandrillMailSystem:: |