For years I am using the tool `reformime' from Courier MTA to detect the DSN, as that way I am quickly marking non-delivered emails and thus also the invalid email addresses.
See http://www.courier-mta.org/reformime.html Option -d: Parse a delivery status notification MIME message (RFC 1894). reformime expects to see on standard input a MIME message that consists of a delivery status notification, as defined by RFC 1894. reformime reads the message and prints on standard output a list of addresses and their corresponding delivery status, as specified in the delivery status notification. Each line printed by reformime consists of a delivery status, a space, and the address. reformime then terminates with a 0 exit status. reformime produces no output and terminates with an exit status of 1 if the standard input does not contain a delivery status notification. Problem with that tool is that it is huge software. I was mostly using and still use Courier MTA on remote servers but I am hesitant using it on internal computers, there I prefer msmtp queue style. That in turn means that there is trouble getting `reformime' tool, as for that I have to install several Courier packages to work. Additionally I may say, DSN is often sent back with lack of standard and `reformime' sometimes fail, then I mark the email address by hand as being invalid. Detecting DSN is not an easy task, one reference is here: https://stackoverflow.com/questions/5298285/detecting-if-an-email-is-a-delivery-status-notification-and-extract-informatio Maybe that facility exists in Mailutils inside the source code? I cannot know. If the facility exists maybe there is some way to expose functions and get the DSN recognized at least by standard? Otherwise I consider now making grep script to recognize DSN, so that I avoid using `reformime'. Jean Take action in Free Software Foundation campaigns: https://www.fsf.org/campaigns In support of Richard M. Stallman https://stallmansupport.org/