[web-master] main: Fix mailing list subscription for digests

From: Date: Fri, 13 Sep 2024 14:13:28 +0000
Subject: [web-master] main: Fix mailing list subscription for digests
Groups: php.webmaster 
Request: Send a blank email to php-webmaster+get-32084@lists.php.net to get a copy of this message
Author: Christoph M. Becker (cmb69) Committer: Derick Rethans (derickr) Date: 2024-09-13T15:11:48+01:00 Commit: https://github.com/php/web-master/commit/345a0e05e2b9d730340662b558114459a8e5ef1f Raw diff: https://github.com/php/web-master/commit/345a0e05e2b9d730340662b558114459a8e5ef1f.diff 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. Changed paths: M public/entry/subscribe.php Diff: 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();

« previous php.webmaster (#32084) next »