Elgg  Version master
DefaultMessageIdHeaderHandler.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Elgg\Email;
4 
11 
21  public function __invoke(\Elgg\Event $event) {
22  $email = $event->getValue();
23  if (!$email instanceof \Elgg\Email) {
24  return;
25  }
26 
27  $hostname = parse_url(elgg_get_site_url(), PHP_URL_HOST);
28  $url_path = parse_url(elgg_get_site_url(), PHP_URL_PATH);
29 
30  $mt = microtime(true);
31 
32  $email->addHeader('Message-ID', "{$url_path}.default.{$mt}@{$hostname}");
33 
34  return $email;
35  }
36 }
$email
Definition: change_email.php:7
Email message.
Definition: Email.php:13
Sets the message-id header for emails.
elgg_get_site_url()
Get the URL for the current (or specified) site, ending with "/".
__invoke(\Elgg\Event $event)
Adds default Message-ID header to all e-mails.
Models an event passed to event handlers.
Definition: Event.php:11