postfix masquerade

Setting relayhost in postfix

The relayhost parameter specifies the default host to send mail to. This is equivalent to the DS entry in sendmails MTA sendmail.cf config file.

!!! note
output below has been trucated for purposes of doucmentation:

PROD linux ~ # cat /etc/postfix/main.cf
# INTERNET OR INTRANET

# The relayhost parameter specifies the default host to send mail to
# when no entry is matched in the optional transport(5) table. When
# no relayhost is given, mail is routed directly to the destination.
#
# On an intranet, specify the organizational domain name. If your
# internal DNS uses no MX records, specify the name of the intranet
# gateway host instead.
#
# In the case of SMTP, specify a domain, host, host:port, [host]:port,
# [address] or [address]:port; the form [host] turns off MX lookups.
#
# If you're connected via UUCP, see also the default_transport parameter.
#
#relayhost = $mydomain
#relayhost = [gateway.my.domain]
#relayhost = [mailserver.isp.tld]
#relayhost = uucphost
#relayhost = [an.ip.add.ress]
relayhost = mr.kristianreese.com

If you’re on an internal network whose domain name does not resolve on the Internet or is not a valid Internet domain name, masquerading the outgoing SMTP email address may be necessary to ensure mail delivery. Many mail servers reject mail addresses with invalid domain names to avoid spam, so masquerading as something that does resolve can help.

To accomplish this, postfix has a parameter smtp_generic_maps that can be setup in main.cf. If not present, append this to the config file:

#specify lookup tables that replace local mail addresses with valid Internet addresses
smtp_generic_maps = hash:/etc/postfix/generic

Next, edit (or create if not present) /etc/postfix/generic and append:

`@linuxmta.int.web.com linuxmta@networksolutions.com`

Run the command postmap /etc/postfix/generic to create or update the postfix lookup tables, then restart postfix.

This will set any email that is sent from linuxmta.int.web.com outbound as coming FROM `linuxmta@networksolutions.com`

Share