diff options
author | Dries Buytaert <dries@buytaert.net> | 2009-10-16 03:01:55 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2009-10-16 03:01:55 +0000 |
commit | 13d3072f418835569f37f65b5055e5b3180fad2e (patch) | |
tree | 6964b91e90d3bddbc3d5ce302897c35a248ddf6b /modules/system/mail.sending.inc | |
parent | b965f7478f34c78b747ad6667738828599e86df7 (diff) | |
download | brdo-13d3072f418835569f37f65b5055e5b3180fad2e.tar.gz brdo-13d3072f418835569f37f65b5055e5b3180fad2e.tar.bz2 |
- Patch #356074 by chx, Damien Tournoud: provide a sequences API.
Diffstat (limited to 'modules/system/mail.sending.inc')
-rw-r--r-- | modules/system/mail.sending.inc | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/modules/system/mail.sending.inc b/modules/system/mail.sending.inc index 6533de07d..96db60bb6 100644 --- a/modules/system/mail.sending.inc +++ b/modules/system/mail.sending.inc @@ -3,21 +3,40 @@ /** * @file - * Drupal core implementations of the DrupalMailSendingInterface. + * Drupal core implementations of MailSystemInterface. */ /** - * The default Drupal mail sending library using PHP's mail function. + * The default Drupal mail backend using PHP's mail function. */ class DefaultMailSystem implements MailSystemInterface { /** + * Concatenate and wrap the e-mail body for plain-text mails. + * + * @param $message + * A message array, as described in hook_mail_alter(). + * + * @return + * The formatted $message. + */ + public function format(array $message) { + // Join the body array into one string. + $message['body'] = implode("\n\n", $message['body']); + // Convert any HTML to plain-text. + $message['body'] = drupal_html_to_text($message['body']); + // Wrap the mail body for sending. + $message['body'] = drupal_wrap_mail($message['body']); + return $message; + } + + /** * Send an e-mail message, using Drupal variables and default settings. - * @see http://php.net/manual/en/function.mail.php the PHP function reference - * for mail(). - * @see drupal_mail() for information on how $message is composed. + * + * @see http://php.net/manual/en/function.mail.php + * @see drupal_mail() * * @param $message - * Message array as described by DrupalMailSendingInterface. + * A message array, as described in hook_mail_alter(). * @return * TRUE if the mail was successfully accepted, otherwise FALSE. */ @@ -44,8 +63,7 @@ class DefaultMailSystem implements MailSystemInterface { * * This class is for running tests or for development. */ -class TestingMailSystem implements MailSystemInterface { - +class TestingMailSystem extends DefaultMailSystem implements MailSystemInterface { /** * Accept an e-mail message and store it in a variable. * |