0

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?

Daniel L
  • 11
  • 2
  • 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. – anx Aug 11 '23 at 01:18
  • 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 – Daniel L Aug 13 '23 at 13:02

1 Answers1

1

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

Daniel L
  • 11
  • 2