Re: Question about message id
On 7 Apr 2024 18:23 +0200, from anton.sharo...@gmail.com (Anton Sharonov): >>> For example Message-Id: <43265...@example.com> consisting of random >>> digits and domain name >> >> There's a good reason for that; it help to ensure uniqueness, which prevents >> problems with threading. By limiting itself to only digits, Yandex's IDs are >> much more likely to collide. > > Hm, not sure about that... Given that string is long enough, > random string which consists only out of digits can perhaps > compete with (much shorter) random string of alpha-numeric > characters - in terms of uniqueness probability? Sure; assuming a Base64 charset, each character encodes log_2(64) = 6 bits; for decimal digits, each character encodes log_2(10) ~ 3.3 bits. Eight decimal digits encode only about 26 bits; eight Base64 characters encode 48 bits. (To encode 48 bits using only decimal digits you need at least 15 digits.) So the decimal digits case has a very much non-trivial chance of a random collision within a fixed domain name in 8 characters, whereas the Base64 case is significantly less likely to have collisions within the same number of characters; in both cases assuming that the part before the @ is assigned at random. Look up the "birthday paradox". The value of the Message-ID header is required by RFC 5322 to be unique. https://www.rfc-editor.org/rfc/rfc5322.html#section-3.6.4 That has been the case since RFC 822 https://www.rfc-editor.org/rfc/rfc822 (section 4.6.1, page 23). RFC 5322 puts the uniqueness of the message ID as a "MUST" level requirement, even going so far as to state that _twice_ within two consecutive sentences. _How you guarantee that uniqueness_ is up to you, but not following that requirement _is_ going to cause a variety of issues, quite possibly up to and including messages not being delivered properly. Violate that requirement at your own peril. -- Michael Kjörling https://michael.kjorling.se “Remember when, on the Internet, nobody cared that you were a dog?”
Re: Question about message id
On Sun, Apr 07, 2024 at 09:23:07AM -0600, Charles Cazabon via Mutt-users wrote: > Ебрашка wrote: > > my mails have Message-ID: . Question, what > > should I write in .muttrc to make my outgoing mails have the same beautiful > > message-ID as Yandex mail? > > My first question would be, why do you care what the Message-ID: field > contents look like? Virtually no-one will ever look at it. Yes, this here is fully true ))) > > > For example Message-Id: <43265...@example.com> consisting of random > > digits and domain name > > There's a good reason for that; it help to ensure uniqueness, which prevents > problems with threading. By limiting itself to only digits, Yandex's IDs are > much more likely to collide. Hm, not sure about that... Given that string is long enough, random string which consists only out of digits can perhaps compete with (much shorter) random string of alpha-numeric characters - in terms of uniqueness probability? > > If you absolutely must do this, have a look at the `message_id_format` > variable. Good hint ))) Attached is the example (perl) script, which can be used as: set message_id_format = "$HOME/bin/mutt_message_id_format_filter '<%z@%f>'|" This converts "left_part" provided by Mutt %z part of Message-ID code (ZhJUjJRaE9InvXxm in your example above), into (much longer) string of only digits (592493855977705398853375435077558962105453 for same example). String of digits is 1:1 mapping of each byte code of every next symbol in the source string, used in the triples with some padding by spaces. Every tripple generates decimal number. All numbers are put after each other into long result. Code is certainly ugly but seems to work. Cheers, Anton #!/usr/bin/perl -w use 5.010; use strict; my $val = $ARGV[0]; my $debug = 0; if (! ($val =~ m/^<([^@]+)@([^>]+)>/)) { print $val; # message format is not recognized exit 0; } my $logfile = undef; if ($debug) { my $log_fname = "/tmp/mutt_message_id_format_filter.log"; open ($logfile, ">>", $log_fname) or die ("Cannot open [$log_fname] for write: $!"); } my $left_part = $1; my $host_n_domain = $2; #abc print $logfile "left_part = $left_part; host_n_domain = $host_n_domain\n" if ($debug); my $new_left_part = ""; while (length($left_part)) { # extract 3 symbols, pad with blanks my $bytes = sprintf("%3.3s", substr($left_part, 0, 3)); my $len = length($left_part); $left_part = substr($left_part, $len >= 3 ? 3 : $len); print $logfile " bytes = {" . $bytes . "}" if ($debug); my $num = 0; for my $i (0..2) { $num *= 256; $num += ord(substr($bytes, $i, 1)); } print $logfile " num = {" . $num . "}\n" if ($debug); $new_left_part .= $num; } print $logfile "\n" if ($debug); print $logfile "<$new_left_part@" . $host_n_domain . ">" if ($debug); print "<$new_left_part@" . $host_n_domain . ">"; print $logfile "\n" if ($debug);
Re: Question about message id
Ебрашка wrote: > my mails have Message-ID: . Question, what > should I write in .muttrc to make my outgoing mails have the same beautiful > message-ID as Yandex mail? My first question would be, why do you care what the Message-ID: field contents look like? Virtually no-one will ever look at it. > For example Message-Id: <43265...@example.com> consisting of random > digits and domain name There's a good reason for that; it help to ensure uniqueness, which prevents problems with threading. By limiting itself to only digits, Yandex's IDs are much more likely to collide. If you absolutely must do this, have a look at the `message_id_format` variable. Charles -- --- Charles Cazabon GPL'ed software available at: http://pyropus.ca/software/ ---
Question about message id
Message-Id: <254061712447...@mail.yandex.ru> - this is how Message-Id looks like when I receive an e-mail sent from Yandex mail web interface. When I send a mail via mutt with activated option set hostname = example.com, my mails have Message-ID: . Question, what should I write in .muttrc to make my outgoing mails have the same beautiful message-ID as Yandex mail? For example Message-Id: <43265...@example.com> consisting of random digits and domain name
Re: pretty-print mutt emails
I do use on FreeBSD muttprint: Name : muttprint Version: 0.73_5 Installed on : Sun Sep 24 11:32:52 2023 CEST Origin : print/muttprint Architecture : FreeBSD:14:amd64 Prefix : /usr/local Categories : print mail Licenses : GPLv2 Maintainer : g...@unixarea.de WWW: http://muttprint.sourceforge.net/ Comment: Utility to print mail for most any mail client Started from ~/.muttrc as: $ grep muttprint .muttrc set print_cmd="muttprint --printer pdf --paper A4 --rem_sig " The result is nice and attached. matthias -- Matthias Apitz, ✉ g...@unixarea.de, http://www.unixarea.de/ +49-176-38902045 Public GnuPG key: http://www.unixarea.de/key.pub I am not at war with Russia. Я не воюю с Россией. Ich bin nicht im Krieg mit Russland.
Re: pretty-print mutt emails
Hello! On Wed, Nov 24, 2021 at 05:21:10PM +, Jean Louis wrote: > * Anders Damsgaard [2021-11-22 12:05]: > > * Globe Trotter via Mutt-users [2021-11-22 00:47:10 > > +]: > > > What is the recommended way to pretty-print mutt emails? I found a > > > sourceforge perl script called muttprint but that was last updated in > > > 2008, and I was wondering what folks here recommended? > > > > I use the following sh(1) script to format the message as troff and > > convert to pdf: https://adamsgaard.dk/tmp/muttprint-groff.sh > > > > It's a bit ugly in places, but it works for me. This is an example: > > https://adamsgaard.dk/tmp/muttprint-example.pdf > > > > I bind it in my muttrc with the following: > > > > set print_command="$HOME/.config/mutt/muttprint-groff.sh" > > Very nice. I find it simple and good. I would like to have the header > fields rather aligned to left side. > > When using grep, I think `grep -m1' should be used to find the first > match, as I wonder what would be the result if words like "From:" or > "Date: " are found in the body of the email, not only in the header. > > I also think I can convert your script to use Asciidoctor instead of > groff, https://asciidoctor.org/ -- so I will work on it. I created a Go program for that use case a while ago: https://gnoack.github.io/mailprint/ I think I am the only user, but it works well for me. It is mostly tuned for the e-mails from the Linux kernel mailing list, so it'll print the mails as plain text, with syntax highlighting for git patches. It also has support for printing the senders' profile pictures from a ~/.picons directory [1]. The website has installation instructions and a screenshot. Under the hood, it is still a shell pipeline piping to groff. You can find some more technical background at [2]. –Günther [1] https://kinzler.com/ftp/faces/ [2] https://blog.gnoack.org/post/mailprint-design/