Looking to have a postfix relay server that takes email from various users & servers [email protected] and rewrite the header to carry just the [email protected] [email protected]
Easy enough to config the relay server to do this with email that originates from within, but I need it to do this to email that is being relay'd through the relay host.
The usernames will vary greatly and I just don't know all of them, the hostnames will vary, but coming out of the relay server I would like the original "From" username to stay the same with just the domain (stripping out the hostname).
Would like emails relayed through the server changed
From: [email protected]
To: [email protected]
main.cf:
compatibility_level = 2
queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
mail_owner = postfix
myhostname = ..com
myorigin = $mydomain
inet_interfaces = all
inet_protocols = all
mydestination = $myhostname, localhost.$mydomain, localhost
unknown_local_recipient_reject_code = 550
mynetworks = 172.0.0.0/8, 127.0.0.0/8
relayhost = [smtp..com]
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
debug_peer_level = 2
debugger_command =
PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
ddd $daemon_directory/$process_name $process_id & sleep 5
sendmail_path = /usr/sbin/sendmail.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix
setgid_group = postdrop
html_directory = no
manpage_directory = /usr/share/man
sample_directory = /usr/share/doc/postfix/samples
readme_directory = /usr/share/doc/postfix/README_FILES
smtpd_tls_cert_file = /etc/pki/tls/certs/postfix.pem
smtpd_tls_key_file = /etc/pki/tls/private/postfix.key
smtpd_tls_security_level = may
smtp_tls_CApath = /etc/pki/tls/certs
smtp_tls_CAfile = /etc/pki/tls/certs/ca-bundle.crt
smtp_tls_security_level = may
meta_directory = /etc/postfix
shlib_directory = /usr/lib64/postfix
smtpd_recipient_restrictions =
permit_mynetworks,
reject_non_fqdn_recipient,
reject_unauth_destination
transport_maps = hash:/etc/postfix/transport
sender_canonical_maps = regexp:/etc/postfix/sender_canonical
sender_canonical file -
/^(.*@).*$/ ${1}mydomain.com