From 5492cea476f0a27e77b1fef588f23dbe3c7ac5bb Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Fri, 13 Sep 2024 13:08:29 +0200 Subject: [PATCH] Fix mailing list subscription for digests The proper way to subscribe to e.g. internals digest is sending a mail to `internals+subscribe-digest@`, but not `internals-digest+subscribe@`. Since `$_POST['maillist']` contains `internals-digest` in this case, we apply a simple regex to catch that, and assemble the proper email address in the following. --- public/entry/subscribe.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/public/entry/subscribe.php b/public/entry/subscribe.php index d38d7c3..53ce0b7 100644 --- a/public/entry/subscribe.php +++ b/public/entry/subscribe.php @@ -35,7 +35,10 @@ $mail->Host = 'mailout.php.net'; $mail->Port = 25; $mail->setFrom($_POST['email']); -$mail->addAddress("{$_POST['maillist']}+{$_POST['request']}@lists.php.net"); +preg_match('/^(.*?)(-digest)?$/', $_POST['maillist'], $matches); +$maillist = $matches[1]; +$digest = count($matches) > 2 ? "-digest" : ""; +$mail->addAddress("{$maillist}+{$_POST['request']}{$digest}@lists.php.net"); $mail->Subject = "PHP Mailing List Website Subscription"; $mail->Body = "This was a request generated from the form at {$_POST['referer']} by {$_POST['remoteip']}"; $mail_sent = $mail->send();