unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Teemu Likonen <tlikonen@iki.fi>
To: Daniel Kahn Gillmor <dkg@fifthhorseman.net>,
	Notmuch Mail <notmuch@notmuchmail.org>
Subject: Re: filtering headers from forwarded messages
Date: Wed, 30 Dec 2020 12:46:02 +0200	[thread overview]
Message-ID: <87r1n7d11x.fsf@iki.fi> (raw)
In-Reply-To: <874kkbulza.fsf@fifthhorseman.net>


[-- Attachment #1.1: Type: text/plain, Size: 2189 bytes --]

* 2020-12-24 12:56:09-0500, Daniel Kahn Gillmor wrote:

>> On Wed 2020-01-08 10:25:50 -0500, Daniel Kahn Gillmor wrote:
>>> Thanks for the pointer! it looks like
>>> message-forward-{ignored,included}-headers should do (roughly) what
>>> i want. I'll try them out.

> Hm, it now looks to me like message-forward-ignored-headers isn't
> working since i upgraded to emacs 27.1. In particular, since:
>
> https://lists.defectivebydesign.org/archive/html/emacs-diffs/2018-04/msg00135.html

I don't know any automatic way to remove headers from an email message
that is stored as a MIME part.

When a forwarded message is stored as inline text (setq
message-forward-as-mime nil) then the message is rendered at the time of
composing the message. Unnecessary headers are removed, character
encodings are decoded etc.

When the forwarded message is stored as MIME type "message/rfc822" (setq
message-forward-as-mime t) then the message is meant to be rendered by
the receiver's email program which will decode all necessary headers,
especially MIME headers, convert between character sets and pretty-print
the message's headers and some of the MIME "text/*" parts.

Filtering or editing headers of email MIME part (message/rfc822) can be
tricky: there are message's main headers which tell the "Content-Type"
of the body, and the body can contain different MIME parts with some of
their own headers. If we filter too much or convert between character
sets the message is not proper message/rfc822 part anymore and can't be
rendered correctly.

What about forwarding a message as MIME part which is just "text/plain"
(and not "message/rfc822")? At least this can be done by setting (setq
message-forward-as-mime nil) and manually inserting Emacs MML tags in
the (notmuch-)message-mode buffer:

    C-c RET p text/plain RET

or calling from Lisp code:

    (mml-insert-part "text/plain")

The inserted MML tags need to be put manually around the forwarded
message. With some hackery one could write a semi-automatic function for
that.

-- 
/// Teemu Likonen - .-.. https://www.iki.fi/tlikonen/
// OpenPGP: 4E1055DC84E9DFF613D78557719D69D324539450

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 251 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



  reply	other threads:[~2020-12-30 10:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-20 18:50 filtering headers from forwarded messages Daniel Kahn Gillmor
2019-12-30 13:16 ` Teemu Likonen
2020-01-08 15:25   ` Daniel Kahn Gillmor
2020-01-16 20:20     ` Daniel Kahn Gillmor
2020-12-24 17:56       ` Daniel Kahn Gillmor
2020-12-30 10:46         ` Teemu Likonen [this message]
2020-12-31 22:39           ` Daniel Kahn Gillmor
2021-01-03  7:48             ` Teemu Likonen
2021-01-03 17:35               ` Daniel Kahn Gillmor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r1n7d11x.fsf@iki.fi \
    --to=tlikonen@iki.fi \
    --cc=dkg@fifthhorseman.net \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

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).