M
M
Maxim Vasiliev2014-09-12 01:25:23
postfix
Maxim Vasiliev, 2014-09-12 01:25:23

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

2 answer(s)
M
Maxim Vasiliev, 2014-09-12
@qmax

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}>

S
Sergey, 2014-09-12
@bk0011m

In general, it is not clear what this is for. I'm sure there are easier ways than messing around with postfix configs.
And in general , here and there . Yes, in general, the topic is hackneyed and Google just brings down kilotons of links

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question