public function TestingMandrillMailSystem::mail in Mandrill 6
Accept an e-mail message and store it in a variable.
Parameters
$message: An e-mail message.
Overrides MandrillMailSystem::mail
File
- ./
mandrill.mail.inc, line 155 - Class for sending mails via Mandrill.
Class
- TestingMandrillMailSystem
- A mail sending implementation that captures sent messages to watchdog.
Code
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;
}