class ForwardMailSystem in Forward 7.3
Same name and namespace in other branches
- 7 forward.module \ForwardMailSystem
- 7.2 forward.module \ForwardMailSystem
Modify the drupal mail system to send HTML emails for the forward module.
Hierarchy
- class \ForwardMailSystem implements MailSystemInterface
Expanded class hierarchy of ForwardMailSystem
1 string reference to 'ForwardMailSystem'
- forward_install in ./
forward.install - Implements hook_install().
File
- ./
forward.mail.inc, line 13 - forward.mail.inc Create a mail system that will send HTML emails
View source
class ForwardMailSystem implements MailSystemInterface {
/**
* Concatenate and wrap the e-mail body.
*
* @param $message
* A message array, as described in hook_mail_alter().
*
* @return
* The formatted $message.
*/
public function format(array $message) {
$message['body'] = implode("\n\n", $message['body']);
return $message;
}
/**
* Send an e-mail message, using Drupal variables and default settings.
*
* @see http://php.net/manual/en/function.mail.php
* @see drupal_mail()
*
* @param $message
* A message array, as described in hook_mail_alter().
* @return
* TRUE if the mail was successfully accepted, otherwise FALSE.
*/
public function mail(array $message) {
$mimeheaders = array();
foreach ($message['headers'] as $name => $value) {
$mimeheaders[] = $name . ': ' . mime_header_encode($value);
}
$line_endings = variable_get('mail_line_endings', MAIL_LINE_ENDINGS);
return mail($message['to'], mime_header_encode($message['subject']), preg_replace('@\\r?\\n@', $line_endings, $message['body']), join("\n", $mimeheaders));
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ForwardMailSystem:: |
public | function |
Concatenate and wrap the e-mail body. Overrides MailSystemInterface:: |
|
ForwardMailSystem:: |
public | function |
Send an e-mail message, using Drupal variables and default settings. Overrides MailSystemInterface:: |