function _views_send_headers in Views Send 6
Same name and namespace in other branches
- 8 views_send.module \_views_send_headers()
- 7 views_send.module \_views_send_headers()
Build header array with priority and receipt confirmation settings.
Parameters
$receipt: Boolean: If a receipt is requested.
$priority: Integer: The message priority.
$from: String: The sender's e-mail address.
Return value
Header array with priority and receipt confirmation info
2 calls to _views_send_headers()
- views_send_form_alter in ./
views_send.module - Implementation of hook_form_alter().
- views_send_mail_action in ./
views_send.module - Main action callback.
File
- ./
views_send.module, line 662 - The Views Send module.
Code
function _views_send_headers($receipt, $priority, $from, $additional_headers) {
$headers = array();
// If receipt is requested, add headers.
if ($receipt) {
$headers['Disposition-Notification-To'] = $from;
$headers['X-Confirm-Reading-To'] = $from;
}
// Add priority if set.
switch ($priority) {
case VIEWS_SEND_PRIORITY_HIGHEST:
$headers['Priority'] = 'High';
$headers['X-Priority'] = '1';
$headers['X-MSMail-Priority'] = 'Highest';
break;
case VIEWS_SEND_PRIORITY_HIGH:
$headers['Priority'] = 'urgent';
$headers['X-Priority'] = '2';
$headers['X-MSMail-Priority'] = 'High';
break;
case VIEWS_SEND_PRIORITY_NORMAL:
$headers['Priority'] = 'normal';
$headers['X-Priority'] = '3';
$headers['X-MSMail-Priority'] = 'Normal';
break;
case VIEWS_SEND_PRIORITY_LOW:
$headers['Priority'] = 'non-urgent';
$headers['X-Priority'] = '4';
$headers['X-MSMail-Priority'] = 'Low';
break;
case VIEWS_SEND_PRIORITY_LOWEST:
$headers['Priority'] = 'non-urgent';
$headers['X-Priority'] = '5';
$headers['X-MSMail-Priority'] = 'Lowest';
break;
}
// Add general headers.
$headers['Precedence'] = 'bulk';
// Add additional headers.
$additional_headers = trim($additional_headers);
$additional_headers = str_replace("\r", "\n", $additional_headers);
$additional_headers = explode("\n", $additional_headers);
foreach ($additional_headers as $header) {
$header = trim($header);
if (!empty($header)) {
list($key, $value) = explode(': ', $header, 2);
$headers[$key] = trim($value);
}
}
return $headers;
}