Answer the question
In order to leave comments, you need to log in
How to rewrite the From field in postfix?
There is a company of servers on which demons from time to time feel like writing to me about a bad life.
Postfix is installed on the servers, which redirects everything to [email protected] and sends it to mailhub, which redirects it all to [email protected]
Letters come with headers like
From: [email protected]
or
From: [email protected] (crondaemon)
In both cases gmail treats either the username part or whatever is in parentheses as a human name.
And for clarity, I want the full address of the local domain to be displayed with a human name.
That is, you need to put something like: From: "[email protected]" <[email protected]>
or From: [email protected] ([email protected])
I think this is done in one line, but I can’t find which one.
Answer the question
In order to leave comments, you need to log in
There is smtp_header_checks for editing headers
(simply header_checks won't help, there may be no From header or there may be bullshit when forming a letter)
smtp_header_checks = regexp:/etc/postfix/header_checks
/From: ([^ ]+) \((.+)\)$/ REPLACE From: "${2} ${1}" <${1}>
/From: ([^ ]+)$/ REPLACE From: "${1}" <${1}>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question