From e4fe464c207b2e2875618b14bf62712aa47b92c8 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 12 Apr 2014 10:01:01 +0000 Subject: [PATCH] mda: add most RFC 2919 and 2369 headers These probably make sense even though we do not handle delivery ourselves. It can aid in searching/filtering/tagging of messages. --- public-inbox-mda | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/public-inbox-mda b/public-inbox-mda index 411ac15f..6e66fa71 100755 --- a/public-inbox-mda +++ b/public-inbox-mda @@ -42,6 +42,7 @@ if (PublicInbox->precheck($filter, $recipient) && # run spamc again on the HTML-free message if (do_spamc($simple, \$filtered)) { $simple = Email::Simple->new($filtered); + set_list_headers($simple, $dst); $filter->simple($simple); my $from = $filter->from; @@ -74,3 +75,17 @@ sub do_spamc { return ($@ || $? || !defined($$out) || length($$out) == 0) ? 0 : 1; } + +# RFC2919 and RFC2369 +sub set_list_headers { + my ($simple, $dst) = @_; + my $pa = "<$dst->{-primary_address}>"; + $simple->header_set("List-Id", $pa); + $simple->header_set("List-Post", $pa); + + my $url = $dst->{url}; + if (defined $url) { + $simple->header_set("List-Archive", "<$url>"); + $simple->header_set("List-Help", "<${url}help>"); + } +} -- 2.44.0