unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
From: "Thomas Weißschuh" <thomas@t-8ch.de>
To: Eric Wong <e@80x24.org>
Cc: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	meta@public-inbox.org
Subject: Re: Bug related to (maybe?) / in Message-Id
Date: Sat, 18 Feb 2023 17:58:57 +0000	[thread overview]
Message-ID: <20230218175857.b6g7aqx7inhbduxz@t-8ch.de> (raw)
In-Reply-To: <20230217102828.M907338@dcvr>

On Fri, Feb 17, 2023 at 10:28:28AM +0000, Eric Wong wrote:
> It's a tragedy that mutt changed their default Message-ID format :<
> Newer versions allow overriding $message_id_format in muttrc,
> but mutt 2.0.5 in Debian 11 won't have it.
> 
> Fwiw, I run mutt on several machines/arches/OSes, getting them
> all to the same new version of mutt will take many years and I
> don't want compile + keep numerous binaries up-to-date in the
> mean time.

Note:

You can also use mutt's builtin facilities to get custom
Message-IDs.

# in muttrc
send-hook . "source ./msgid"

# in file "msgid" next to muttrc
# put any command within the backticks
my_hdr Message-ID: <`uuidgen -r`@t-8ch.de>

The extra config file and "source" command are needed to force
reevaluation of the backticks for each message.

This should also work in older versions of mutt and has the advantage
that mutt knows about the actual Message-ID, for example showing it with
edit_headers=yes.

> I also use msmtp and distribute my muttrc + ~/bin to all of
> them, so I wrote this msmtp wrapper which is mutt-version-agnostic:
> 
> $ cat $HOME/bin/msmtp-msgid
> eval 'exec perl -w -S $0 ${1+"$@"}'
> if 0; # running under some shell
> # in muttrc:
> # set sendmail = msmtp-msgid
> use v5.12;
> my ($hdr, $bdy) = split(/\n\n/, do { local $/; <STDIN> }, 2);
> if ($hdr !~ /^Message-ID:\s*<\d{14}\b/aims) {
> 	my $h;
> 	if ($hdr =~ /^Message-ID:[^@]+\@([^>]+)>/ims) {
> 		$h = $1;
> 	} else {
> 		require Sys::Hostname;
> 		$h = Sys::Hostname::hostname();
> 	}
> 	require POSIX;
> 	require Time::HiRes;
> 	my ($time, $msec) = Time::HiRes::gettimeofday();
> 	my $msgid = POSIX::strftime("%Y%m%d%H%M%S.M$msec", gmtime($time));
> 	$hdr =~ s/^Message-ID:[^\n]+/Message-ID: <$msgid\@$h>/msi;
> }
> my $pid = open(my $fh, '|-', 'msmtp', @ARGV) // die "popen: $!";
> print $fh $hdr, "\n\n", $bdy or die "print $!";
> close $fh or die "msmtp \$?=$?";
> __END__

  parent reply	other threads:[~2023-02-18 17:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-16 21:05 Bug related to (maybe?) / in Message-Id Uwe Kleine-König
2023-02-16 21:36 ` Eric Wong
2023-02-17  8:52   ` Uwe Kleine-König
2023-02-17 10:28     ` Eric Wong
2023-02-17 10:32       ` [PATCH] TODO: handle more cases of unencoded slashes Eric Wong
2023-02-17 11:08       ` [PATCH] public-inbox.cgi(1): Mention AllowEncodedSlashes for Apache setups Uwe Kleine-König
2023-02-17 13:15         ` Eric Wong
2023-02-18 17:58       ` Thomas Weißschuh [this message]
2023-02-18 18:06         ` Bug related to (maybe?) / in Message-Id Thomas Weißschuh
2023-03-07  8:31           ` Eric Wong
2023-03-07 22:30             ` Eric Wong

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://public-inbox.org/README

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

  git send-email \
    --in-reply-to=20230218175857.b6g7aqx7inhbduxz@t-8ch.de \
    --to=thomas@t-8ch.de \
    --cc=e@80x24.org \
    --cc=meta@public-inbox.org \
    --cc=u.kleine-koenig@pengutronix.de \
    /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.
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).