Hi all,
I recently received a message with an invalidity in the display-name
portion of a From: header (reproduction below), and it foiled some
script I run occasionally, mostly down to an %(addr{from}) in a format:
apparently, addr cannot extract just the host@mbox in case of this
invalidity.
So I think I have 2 questions:
1. Could (should?) %(addr{<component>}) be expected to be able to
extract the addr-spec part out of an invalid message header?
2. Has anybody got general tips on dealing with slightly-invalid
messages in nmh? They seem somewhat unavoidable.
Thanks in advance,
Richard
Here's a pared-down reproduction. In both the To: and From: headers, the
existence of a dot necessitates quoting for a valid display-name. The
RFC 2047 encoding is a side issue, but I figured it was worth
mentioning, for completeness. The upshot is that for this message,
$ scan -file message.txt -format '%(addr{to})'
Mr. Jones <[email protected]>
$ scan -file message.txt -format '%(addr{from})'
=?utf-8?q?Mr.=20Smith?= <[email protected]>
--
Date: Wed, 29 Mar 2023 13:21:25 -0500
Subject: Sample message
Message-Id: <[email protected]>
To: Mr. Jones <[email protected]>
From: =?utf-8?q?Mr.=20Smith?= <[email protected]>
Sample message.
--