From 101681070b85d986d435b8387e78055932555f72 Mon Sep 17 00:00:00 2001 From: Oliver Schramm Date: Sun, 16 Sep 2018 12:28:34 +0200 Subject: [PATCH] [ticket/14656] Add List-Unsubscribe header to emails PHPBB3-14656 --- phpBB/includes/functions_messenger.php | 6 ++++++ phpBB/language/en/email/forum_notify.txt | 1 + phpBB/language/en/email/newtopic_notify.txt | 1 + phpBB/language/en/email/topic_notify.txt | 1 + 4 files changed, 9 insertions(+) diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index a85a3b67c5..54f2d5b4e4 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -369,6 +369,12 @@ class messenger $this->subject = (($this->subject != '') ? $this->subject : $user->lang['NO_EMAIL_SUBJECT']); } + if (preg_match('#^(List-Unsubscribe:(.*?))$#m', $this->msg, $match)) + { + $this->extra_headers[] = $match[1]; + $drop_header .= '[\r\n]*?' . preg_quote($match[1], '#'); + } + if ($drop_header) { $this->msg = trim(preg_replace('#' . $drop_header . '#s', '', $this->msg)); diff --git a/phpBB/language/en/email/forum_notify.txt b/phpBB/language/en/email/forum_notify.txt index ccae82c862..1dfe8c652d 100644 --- a/phpBB/language/en/email/forum_notify.txt +++ b/phpBB/language/en/email/forum_notify.txt @@ -1,4 +1,5 @@ Subject: Forum post notification - "{FORUM_NAME}" +List-Unsubscribe: <{U_STOP_WATCHING_FORUM}> Hello {USERNAME}, diff --git a/phpBB/language/en/email/newtopic_notify.txt b/phpBB/language/en/email/newtopic_notify.txt index 12e0bb8393..0dfc9e43b4 100644 --- a/phpBB/language/en/email/newtopic_notify.txt +++ b/phpBB/language/en/email/newtopic_notify.txt @@ -1,4 +1,5 @@ Subject: New topic notification - "{FORUM_NAME}" +List-Unsubscribe: <{U_STOP_WATCHING_FORUM}> Hello {USERNAME}, diff --git a/phpBB/language/en/email/topic_notify.txt b/phpBB/language/en/email/topic_notify.txt index 20b86ee729..92bf85806e 100644 --- a/phpBB/language/en/email/topic_notify.txt +++ b/phpBB/language/en/email/topic_notify.txt @@ -1,4 +1,5 @@ Subject: Topic reply notification - "{TOPIC_TITLE}" +List-Unsubscribe: <{U_STOP_WATCHING_TOPIC}> Hello {USERNAME},