Score:0

Postfix smtp_header_checks does not prepend header, but ignores or warns

sg flag

I am trying to add those headers to email sent via the postfix server:

Precedence: bulk
Auto-Submitted: auto-generated

These are the configuration files and only header_checks adds the correct header.

/etc/postfix/main.cf

#add header
header_checks = regexp:/etc/postfix/header_auto_submitted

# ALSO WORKS:
#header_checks=regexp:/etc/postfix/header_precedence_bulk

# DOES WORK:
#smtp_header_checks = regexp:/etc/postfix/header_warn
# DOES NOT WORK FOR SOME REASON:
smtp_header_checks = pcre:/etc/postfix/header_precedence_bulk.pcre
#smtp_header_checks=regexp:/etc/postfix/header_precedence_bulk

This does add the Precedence: bulk header:

header_checks=regexp:/etc/postfix/header_precedence_bulk

This also does not work: /etc/postfix/master.cf

10025   inet    n       -       n       -       -       smtpd       -o smtp_header_checks = pcre:/etc/postfix/header_precedence_bulk.pcre

Here are the files containing the regexp:

/etc/postfix/header_auto_submitted

/^MIME-Version:/i PREPEND Auto-Submitted: auto-generated

/etc/postfix/header_warn

/^subject:/      WARN

/etc/postfix/header_precedence_bulk.pcre and /etc/postfix/header_precedence_bulk

/^MIME-Version:/i PREPEND Precedence: bulk

So the header_precedence_bulk file is correct.

Also the smtp_header_checks = regexp:/etc/postfix/header_warn works. So the smtp_header_checks is not blocked anywhere.

How can we make smtp_header_checks prepend both headers on the Postfix server?

anx avatar
fr flag
anx
But the WARN line you are testing is not looking for the same pattern as your PREPEND line is? In any case, case-sensitive matching on a header sounds wrong.
Daniel L avatar
sg flag
thank you @anx that helped me figure it out and put me on the way. However the wird thing is that it indeed was matching for #header_checks=regexp:/etc/postfix/header_precedence_bulk, just not smpt_header_checks
Score:1
sg flag

I resolved it by editing the files /etc/postfix/header_precedence_bulk and /etc/postfix/header_precedence_bulk.pcre and changing content to this:

/^Auto-Submitted:/ PREPEND Precedence: bulk

So for some reason smtp_header_checks could not match the same condition as header_checks

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.