static function Messaging_Method_Mail::mail_headers in Messaging 6.4
Get mail headers. Helper function for mail methods
Parameters
$params: Array of parameters with the following elements
- 'from', Mail from address
- 'default_from', Default from address
- 'headers', Predefined headers to be added to this one
1 call to Messaging_Method_Mail::mail_headers()
- Messaging_Method_Mail::mail_params in messaging_mail/
messaging_method_mail.class.inc - Prepare from address and mail headers
File
- messaging_mail/
messaging_method_mail.class.inc, line 151 - Drupal Messaging Framework - Send_Method class file
Class
- Messaging_Method_Mail
- Base class for mail sending methods
Code
static function mail_headers($params) {
$headers = !empty($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 = $params['default_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;
}