Elgg  Version 4.3
DefaultMessageIdHeaderHandler.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Elgg\Email;
4 
11 
21  public function __invoke(\Elgg\Hook $hook) {
22  $email = $hook->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
elgg parse_url
Parse a URL into its parts.
Definition: elgglib.js:135
Models an event passed to hook handlers.
Definition: Hook.php:11
__invoke(\Elgg\Hook $hook)
Adds default Message-ID header to all e-mails.
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 "/".