public function SimplenewsSourceEntity::getHeaders in Simplenews 7.2
Implements SimplenewsSourceInterface::getHeaders().
Overrides SimplenewsSourceInterface::getHeaders
File
- includes/
simplenews.source.inc, line 441 - Contains SimplenewsSource interface and implementations.
Class
- SimplenewsSourceEntity
- Default source class for entities.
Code
public function getHeaders(array $headers) {
// If receipt is requested, add headers.
if ($this->newsletter->receipt) {
$headers['Disposition-Notification-To'] = $this
->getFromAddress();
$headers['X-Confirm-Reading-To'] = $this
->getFromAddress();
}
// Add priority if set.
switch ($this->newsletter->priority) {
case SIMPLENEWS_PRIORITY_HIGHEST:
$headers['Priority'] = 'High';
$headers['X-Priority'] = '1';
$headers['X-MSMail-Priority'] = 'Highest';
break;
case SIMPLENEWS_PRIORITY_HIGH:
$headers['Priority'] = 'urgent';
$headers['X-Priority'] = '2';
$headers['X-MSMail-Priority'] = 'High';
break;
case SIMPLENEWS_PRIORITY_NORMAL:
$headers['Priority'] = 'normal';
$headers['X-Priority'] = '3';
$headers['X-MSMail-Priority'] = 'Normal';
break;
case SIMPLENEWS_PRIORITY_LOW:
$headers['Priority'] = 'non-urgent';
$headers['X-Priority'] = '4';
$headers['X-MSMail-Priority'] = 'Low';
break;
case SIMPLENEWS_PRIORITY_LOWEST:
$headers['Priority'] = 'non-urgent';
$headers['X-Priority'] = '5';
$headers['X-MSMail-Priority'] = 'Lowest';
break;
}
// Add user specific header data.
$headers['From'] = $this
->getFromFormatted();
$headers['List-Unsubscribe'] = '<' . token_replace('[simplenews-subscriber:unsubscribe-url]', $this
->getTokenContext(), array(
'sanitize' => FALSE,
)) . '>';
// Add general headers
$headers['Precedence'] = 'bulk';
return $headers;
}