function messaging_mail_headers in Messaging 6.2
Same name and namespace in other branches
- 6 messaging.mail.inc \messaging_mail_headers()
- 6.3 messaging.mail.inc \messaging_mail_headers()
Get mail headers. Helper function for mail methods
1 call to messaging_mail_headers()
- messaging_mail_prepare in ./
messaging.mail.inc - Rebuild message in Drupal mail format
File
- ./
messaging.mail.inc, line 67 - Common library for mail methods
Code
function messaging_mail_headers($message, $params) {
$headers = !empty($params['headers']) && is_array($params['headers']) ? $params['headers'] : array();
// Add some default headers
$headers += array(
'MIME-Version' => '1.0',
'Content-Type' => 'text/plain; charset=UTF-8; format=flowed; delsp=yes',
'Content-Transfer-Encoding' => '8Bit',
'X-Mailer' => 'Drupal',
);
$default_from = variable_get('site_mail', ini_get('sendmail_from'));
$from = !empty($params['from']) ? $params['from'] : $default_from;
// Set default headers depending on data
$headers += array(
'From' => $from,
'Reply-To' => $from,
);
if ($params['returnpath']) {
// To prevent e-mail from looking like spam, the addresses in the Sender and
// Return-Path headers should have a domain authorized to use the originating
// SMTP server. Errors-To is redundant, but shouldn't hurt.
$more_headers['Sender'] = $more_headers['Return-Path'] = $more_headers['Errors-To'] = $params['returnpath'];
$headers += $more_headers;
}
return $headers;
}