static function Messaging_Method_Mail::mail_params in Messaging 6.4
Prepare from address and mail headers
2 calls to Messaging_Method_Mail::mail_params()
- Messaging_Method_Mail::mail_build in messaging_mail/
messaging_method_mail.class.inc - Rebuild message in Drupal mail format, right before sending
- Messaging_Method_Mail::message_prepare in messaging_mail/
messaging_method_mail.class.inc - Message default callback: prepare
File
- messaging_mail/
messaging_method_mail.class.inc, line 112 - Drupal Messaging Framework - Send_Method class file
Class
- Messaging_Method_Mail
- Base class for mail sending methods
Code
static function mail_params($message, $params = array()) {
// The message 'from' will depend on message sender if present, otherwise default to site mail
if (empty($params['from'])) {
$sender_name = $message
->get_sender_name();
$sender_account = $message
->get_sender();
if ($sender_name && $sender_account && !empty($sender_account->mail)) {
$from = self::format_from($sender_name, $sender_account->mail);
}
elseif ($sender_name) {
$from = self::format_from($sender_name, $params['default_from']);
}
else {
$from = $params['default_from'];
}
$params['from'] = $from;
}
else {
$from = $params['from'];
}
// Set headers, or add to existing ones. Pre-existing ones should not be overridden.
$headers = self::mail_headers($params);
$params += array(
'id' => 'messaging_' . (!empty($message->type) ? 'message-' . $message->type : 'message'),
'from' => $from,
'headers' => array(),
);
$params['headers'] += $headers;
return $params;
}