How to masquerade or change outgoing SMTP email or from mail address in postfix

address rewriting allows changing outgoing email ID or domain name itself. This is good for hiding internal user names. For example:
SMTP user: jack
EMAIL ID: jack @domain.com
Server name: srv01.domain.com

Postfix MTA offers smtp_generic_maps parameter. You can specify lookup tables that replace local mail addresses by valid Internet addresses when mail leaves the machine via SMTP.

Open your main.cf file
# vi /etc/postfix/main.cf

Append following parameter
smtp_generic_maps = hash:/etc/postfix/generic

Save and close the file. Open /etc/postfix/generic file:
# vi /etc/postfix/generic


jack@domain.com  mamun@example.com

Save and close the file. Create or update generic postfix table:
# postmap /etc/postfix/generic

Restart postfix:
# /etc/init.d/postfix restart

When mail is sent to a remote host via SMTP this replaces jack@domain.com by mamun@example.com mail address. You can use this trick to replace address with your ISP address if you are connected via local SMTP.

0 comments:

Post a Comment