You are here

function Messaging_Mail_Method::message_prepare in Messaging 6.3

Same name and namespace in other branches
  1. 7 messaging_mail/messaging_mail.inc \Messaging_Mail_Method::message_prepare()

Rebuild message in Drupal mail format

Parameters

$message: Message object

File

classes/messaging_method.class.inc, line 336
Drupal Messaging Framework - Send_Method class file

Class

Messaging_Mail_Method
Base class for mail sending methods

Code

function message_prepare($message) {
  if (empty($message->params['from'])) {
    if (!empty($message->sender_account) && !empty($message->sender_account->mail)) {
      $from = check_plain($message->sender_account->name) . ' <' . $message->sender_account->mail . '>';
    }
    elseif (!empty($message->sender_name) && $default_from) {
      $from = check_plain($message->sender_name) . ' <' . $this->default_from . '>';
    }
    else {
      $from = $this->default_from;
    }
    $message->params['from'] = $from;
  }
  $message->params['mail_headers'] = $this
    ->mail_headers($message);
}