diff options
-rwxr-xr-x | Documentation/standards.perl | 4 | ||||
-rw-r--r-- | examples/unsubscribe.milter | 7 |
2 files changed, 10 insertions, 1 deletions
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; |