Create a log file con be done two ways.
#run the command
postconf maillog_file= /var/log/postfix.logor it can be done by adding a line to mail.cf
echo "postconf maillog_file= /var/log/postfix.log"re-write can be handled via a /etc/postfix/generic file.
In the postfix/main.cf add the following
#/etc/postfix/main.cf
smtp_generic_maps = hash:/etc/postfix/genericThen create a /etc/postfix/generic file as below and add additional users if needed.
root@localdomain myaccount@myoffice356domain.com
@localdomain myaccount@myoffice356domain.com
root@myserver myaccount@myoffice356domain.com
userA@myserver myaccount@myoffice356domain.comAfter creating this file you need to update thew postfix lookup table management by using the postmap command
# after creating or changing the generic file run postmap
postmap /etc/postfix/generic
# restart postfix
systemctl restart postfixDont forget to postmap an restart after changing the files
In some cases you want to rewrite all email for a specific domain to another domains. For example all incoming email for example.org should be rewritten to example.com. Postfix uses canonical maps to rewrite domains or mail addresses. Insert the following line to the /etc/postfix/main.cf:
# /etc/postfix/main.cf
canonical_maps = hash:/etc/postfix/canonicalcreate a new file /etc/postfix/cononical and define in this file the domain rewrites
@example.org @example.com# after creating or changing the generic file run postmap
postmap /etc/postfix/canonical
# restart postfix
systemctl restart postfixDont forget to postmap an restart after changing the files