Created
May 13, 2011 22:54
-
-
Save eegrok/971468 to your computer and use it in GitHub Desktop.
Modify the to: header in postfix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# so recently I had an issue where I wanted to send email sent to a local user root (from logwatch, e.g.) to a different email address | |
# simple enough -- just add a ~root/.forward file, with the contents [email protected] | |
# all the email gets sent there... | |
# but the email shows up with a to: header of [email protected] | |
# what I really want is the to: header to be [email protected] | |
# so I can filter emails, etc... below is how to do that. | |
#uncomment the following line in /etc/postfix/main.cf | |
#header_checks = regexp:/etc/postfix/header_checks | |
# then edit /etc/postfix/header_checks, and add a line like this: | |
# (replace root in the first line with the local username) | |
# and make sure the to: is lowercase -- even though it shows up in uppercase in my email client, uppercase doesn't match | |
# note that you can use WARN instead of REPLACE, and it will give you a log message if the regexp matches | |
# along with the full line that matched, so you can figure out what it should be | |
/^to:\s+root$/ | |
REPLACE To: [email protected] | |
# then do: | |
sudo postmap /etc/postfix/header_checks | |
# and restart postfix | |
sudo postfix reload |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment