Merge pull request #5363 from Elsensee/ticket/14656

[ticket/14656] Add List-Unsubscribe header to emails
This commit is contained in:
Marc Alexander 2018-10-27 23:36:45 +02:00
commit a772949162
No known key found for this signature in database
GPG key ID: 50E0D2423696F995
4 changed files with 9 additions and 0 deletions

View file

@ -373,6 +373,12 @@ class messenger
$this->subject = (($this->subject != '') ? $this->subject : $user->lang['NO_EMAIL_SUBJECT']); $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) if ($drop_header)
{ {
$this->msg = trim(preg_replace('#' . $drop_header . '#s', '', $this->msg)); $this->msg = trim(preg_replace('#' . $drop_header . '#s', '', $this->msg));

View file

@ -1,4 +1,5 @@
Subject: Forum post notification - "{FORUM_NAME}" Subject: Forum post notification - "{FORUM_NAME}"
List-Unsubscribe: <{U_STOP_WATCHING_FORUM}>
Hello {USERNAME}, Hello {USERNAME},

View file

@ -1,4 +1,5 @@
Subject: New topic notification - "{FORUM_NAME}" Subject: New topic notification - "{FORUM_NAME}"
List-Unsubscribe: <{U_STOP_WATCHING_FORUM}>
Hello {USERNAME}, Hello {USERNAME},

View file

@ -1,4 +1,5 @@
Subject: Topic reply notification - "{TOPIC_TITLE}" Subject: Topic reply notification - "{TOPIC_TITLE}"
List-Unsubscribe: <{U_STOP_WATCHING_TOPIC}>
Hello {USERNAME}, Hello {USERNAME},