unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
* [PATCH] examples/unsubscribe.milter: RFC 8058 (List-Unsubscribe=One-Click)
@ 2022-04-02  1:56 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2022-04-02  1:56 UTC (permalink / raw)
  To: meta

This allows unambiguous signaling to some MUAs and webmail clients
that th List-Unsubscribe header contains an instantaneous
unsubscribe option.
---
 Documentation/standards.perl | 4 ++++
 examples/unsubscribe.milter  | 7 ++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/Documentation/standards.perl b/Documentation/standards.perl
index 32003c91..69568ceb 100755
--- a/Documentation/standards.perl
+++ b/Documentation/standards.perl
@@ -62,6 +62,10 @@ my $rfcs = [
 	# 8621 => JSON Meta Application Protocol (JMAP) for Mail
 	# ...
 
+	# examples/unsubscribe.milter and PublicInbox::Unsubscribe
+	2369 => 'URLs as Meta-Syntax for Core Mail List Commands',
+	8058 => 'Signaling One-Click Functionality for List Email Headers',
+
 	# TODO: flesh this out
 
 ];
diff --git a/examples/unsubscribe.milter b/examples/unsubscribe.milter
index 04a39761..216b0ddd 100644
--- a/examples/unsubscribe.milter
+++ b/examples/unsubscribe.milter
@@ -1,5 +1,5 @@
 #!/usr/bin/perl -w
-# Copyright (C) 2016-2021 all contributors <meta@public-inbox.org>
+# Copyright (C) all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 use strict;
 use Sendmail::PMilter qw(:all);
@@ -96,6 +96,7 @@ $cbs{eom} = sub {
 
 		my $unsub = $priv->{header}->{'list-unsubscribe'} || [];
 		my $n = 0;
+		my $added;
 		foreach my $u (@$unsub) {
 			# Milter indices are 1-based,
 			# not 0-based like Perl arrays
@@ -114,7 +115,11 @@ $cbs{eom} = sub {
 			$v .= ",\n <https://$domain/u/$u/$list>";
 
 			$ctx->chgheader($k, $index, $v);
+			$added = 1;
 		}
+		# RFC 8058
+		$added and $ctx->addheader('List-Unsubscribe-Post',
+					'List-Unsubscribe=One-Click');
 	};
 	warn $@ if $@;
 	SMFIS_CONTINUE;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-04-02  1:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-02  1:56 [PATCH] examples/unsubscribe.milter: RFC 8058 (List-Unsubscribe=One-Click) Eric Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).