aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorNils Adermann <naderman@naderman.de>2013-02-24 19:07:24 +0100
committerNils Adermann <naderman@naderman.de>2013-02-24 19:07:24 +0100
commit4615698807e17c55d5ab93e872f7efefb1e6acd7 (patch)
treeb2652ac32956f86616400781be460ef207d65419 /phpBB
parentfe219e4bbe53637d0a26cbcafac543140d5a1e86 (diff)
downloadforums-4615698807e17c55d5ab93e872f7efefb1e6acd7.tar
forums-4615698807e17c55d5ab93e872f7efefb1e6acd7.tar.gz
forums-4615698807e17c55d5ab93e872f7efefb1e6acd7.tar.bz2
forums-4615698807e17c55d5ab93e872f7efefb1e6acd7.tar.xz
forums-4615698807e17c55d5ab93e872f7efefb1e6acd7.zip
[ticket/10986] message.id fallback to SERVER_NAME or phpbb.generated
Rather than send invalid message ids with a missing domain part we try to read one from $_SERVER and otherwise use phpbb.generated PHPBB3-10986
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/includes/functions_messenger.php24
1 files changed, 23 insertions, 1 deletions
diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php
index e837811c86..db2dea33e8 100644
--- a/phpBB/includes/functions_messenger.php
+++ b/phpBB/includes/functions_messenger.php
@@ -390,6 +390,28 @@ class messenger
}
/**
+ * Generates a valid message id to be used in emails
+ *
+ * @return string message id
+ */
+ function generate_message_id()
+ {
+ global $config;
+
+ $domain = 'phpbb.generated';
+ if ($config['server_name'])
+ {
+ $domain = $config['server_name'];
+ }
+ else if (!empty($_SERVER['SERVER_NAME']))
+ {
+ $domain = $_SERVER['SERVER_NAME'];
+ }
+
+ return md5(unique_id(time())) . '@' . $domain;
+ }
+
+ /**
* Return email header
*/
function build_header($to, $cc, $bcc)
@@ -415,7 +437,7 @@ class messenger
$headers[] = 'Return-Path: <' . $config['board_email'] . '>';
$headers[] = 'Sender: <' . $config['board_email'] . '>';
$headers[] = 'MIME-Version: 1.0';
- $headers[] = 'Message-ID: <' . md5(unique_id(time())) . '@' . $config['server_name'] . '>';
+ $headers[] = 'Message-ID: <' . $this->generate_message_id() . '>';
$headers[] = 'Date: ' . date('r', time());
$headers[] = 'Content-Type: text/plain; charset=UTF-8'; // format=flowed
$headers[] = 'Content-Transfer-Encoding: 8bit'; // 7bit