[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
%(addr{<component>}) and RFC-invalid headers
From: |
Richard M Kreuter |
Subject: |
%(addr{<component>}) and RFC-invalid headers |
Date: |
Wed, 29 Mar 2023 14:45:52 -0400 |
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 <jones@example.com>
$ scan -file message.txt -format '%(addr{from})'
=?utf-8?q?Mr.=20Smith?= <smith@example.com>
--
Date: Wed, 29 Mar 2023 13:21:25 -0500
Subject: Sample message
Message-Id: <3889099285.52275.4@example.com>
To: Mr. Jones <jones@example.com>
From: =?utf-8?q?Mr.=20Smith?= <smith@example.com>
Sample message.
--
- %(addr{<component>}) and RFC-invalid headers,
Richard M Kreuter <=