In these days I have a case where I have to change the domain name of e-mail addresses which are sent out to the Internet. So all e-mails sent out to the Internet need to have the sending addresses changed.
To be more specific: Big company (bigcompany.com) bought small company (smallcompany.com) and from now on all outgoing e-mails must be sent with bigcompany.com addresses. But of course the mail server still needs to receive e-mails for smallcompany.com.
After some research I found the parameter smtp_generic_maps, which looks pretty good:
" When mail is sent to a remote host via SMTP, this replaces email@example.com by his ISP mail address, replaces firstname.lastname@example.org by her ISP mail address, ...."
But the problem is, that my Postfix solution is a mail gateway (anti-spam, anti-virus) in front of an Exchange server. Therefore the mailboxes are not on the Postfix server and e-mails are forwarded... yes... to a remote host. So even for incoming e-mails the smtp_generic_maps parameter will be applied and smallcompany.com will be replaced by bigcompany.com (and will therefore be relayed to the MX of bigcompany.com).
So I had to look for another solution. This time I found what I was looking for: The sender_canonical_maps parameter! In the documentation the following text describes this parameter:
Example: you want to rewrite the SENDER address "email@example.com" to "firstname.lastname@example.org", while still being able to send mail to the RECIPIENT address "email@example.com".
Yes - this is exactly what I need. I still need to be able to receive e-mails for ugly.domain (smallcompany.com) but all sending domains need to be changed from ugly.domain to pretty.domain (bigcompany.com).
# Change outgoing email addresses to be @bigcompany.com
# 01.06.2011 Claudio
sender_canonical_maps = hash:/etc/postfix/sender_canonical
No comments yet.
Personal Internet VMware PHP Linux Shell Bluecoat Proxy Windows Hardware Virtualization Nagios MySQL DB Monitoring Mail Android Network Wyse Hacks Tomcat Postgres Apple Mac Surveillance Backup BSD ZFS Solaris SmartOS Unix Multimedia Perl Database MongoDB CMS OTRS FreeBSD Wordpress LXC Nginx Proxmox DNS Graphics PowerDNS GlusterFS Security Chef HAProxy Icinga Ansible HTML MariaDB ELK Elasticsearch Containers Rancher Docker AWS Kibana Logstash Filebeat Varnish PGSQL PostgreSQL ElasticSearch CouchDB Bash Macintosh Container Minio Grafana InfluxDB Databases NFS OSSEC SystemD Java Zoneminder SSL TLS Icingaweb2 Cloud Wireless Kubernetes Ubuntu