Re: WIP: filter out envelope headers in notmuch-insert.

Subject: Re: WIP: filter out envelope headers in notmuch-insert.

Date: Sat, 12 Feb 2022 07:34:43 -0400



From: David Bremner

David Bremner <> writes:

> I thought about a more ambitious version that would replace any
> existing "Return-Path" headers, but it seems like significantly more
> work (the current code is not line based), and not obviously
> better. Or maybe I missed the wording in the RFCs that talks about how
> MDAs should behave here.

The RFC wording I _did_ find is as follows.

RFC5598 says that (§4.3.3)

      The MDA records the RFC5321.MailFrom address into the
      RFC5321.Return-Path field.

where the first is the (address in) envelope from and the second is the
Return-Path: header. I'm not sure how authoritative RFC5598 really is;
it is "Category: Informational", whatever that means.

On the other hand RFC5321 §4.4 says

   When the delivery SMTP server makes the "final delivery" of a
   message, it inserts a return-path line at the beginning of the mail
   data.  This use of return-path is required; mail systems MUST support
   it.  The return-path line preserves the information in the <reverse-
   path> from the MAIL command.  Here, final delivery means the message
   has left the SMTP environment.  Normally, this would mean it had been
   delivered to the destination user or an associated mail drop, but in
   some cases it may be further processed and transmitted by another
   mail system.

At least postfix seems to follow the latter, but also includes the
envelope header when passing a message to a program via .forward.

This seems to imply that if we can trust the MTA to DTRT, the
Return-Path should already be present. OTOH, that is obviously not the
most robust assumption possible.

notmuch mailing list --
To unsubscribe send an email to