commerce_invoice_receipt.mailsystem.inc in Commerce Invoice Receipt 7.2
Contains the mailsystem used by Commerce Invoice Receipt module.
File
commerce_invoice_receipt.mailsystem.incView source
<?php
/**
* @file
* Contains the mailsystem used by Commerce Invoice Receipt module.
*/
/**
* Modify the drupal mail system to send HTML emails.
*/
class InvoiceMailSystem 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) {
$message['body'] = implode("\n\n", $message['body']);
return $message;
}
/**
* Send an e-mail message, using Drupal variables and default settings.
*
* @see <a href="http://php.net/manual/en/function.mail.php" title="http://php.net/manual/en/function.mail.php" rel="nofollow">http://php.net/manual/en/function.mail.php</a>
* @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));
}
}
Classes
Name | Description |
---|---|
InvoiceMailSystem | Modify the drupal mail system to send HTML emails. |