You are here

public function CommerceMailSystem::mail in Commerce Email 7

Send an e-mail message, using Drupal variables and default settings.

Parameters

$message: A message array, as described in hook_mail_alter().

Return value

TRUE if the mail was successfully accepted, otherwise FALSE.

Overrides MailSystemInterface::mail

See also

http://php.net/manual/en/function.mail.php

drupal_mail()

File

./commerce_email.module, line 645
Defines additional menu item and order html email functonality.

Class

CommerceMailSystem
Modify the drupal mail system to send HTML emails.

Code

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);
  if (isset($message['headers']['Return-Path']) && !ini_get('safe_mode')) {
    return mail($message['to'], mime_header_encode($message['subject']), preg_replace('@\\r?\\n@', $line_endings, $message['body']), join("\n", $mimeheaders), '-f ' . $message['Return-Path']);
  }
  else {
    return mail($message['to'], mime_header_encode($message['subject']), preg_replace('@\\r?\\n@', $line_endings, $message['body']), join("\n", $mimeheaders));
  }
}