Take a look at sendmail. If you have flexibility in what command you use and the syntax it might work. Though I don't think you can control where the added header ends up.

sendmail -f fropm-id j...@example.com
X-test: testing
Subject: test

hello
<EOF>


On Tue, Jan 03, 2023 at 08:33:22AM +0100, Harald Dunkel wrote:
Hi folks,

is there some way for OpenBSD's mailx (reading an EMail to send from
stdin) to add fields to the EMail header, e.g.

        Auto-Submitted: auto-generated

for generated EMails, according to the recommendation in RFC 3834?
Or maybe

        Precedence: bulk

Maybe some custom fields like

        X-monitoring-severity: disaster
?

This could help to avoid a lot of unnecessary vacation responses,
support automatic filtering, etc.

The mailx command line could be

        echo hello | \
        mailx -s hello -a "Auto-Submitted: auto-generated" j...@example.com

I thought about making "Auto-Submitted: auto-generated" the default
for reading an EMail from stdin (if its not a tty), but this might
break existing code.


Regards

Harri


Reply via email to