Postfix part 4 SMART HOST and NULL CLIENT





The main.cf in remaining server should contain  valid myhostname, mydomain values.+ iptables should allow port 25


========================================================================
Defining SmartHost
Initially check that what domains the postfix will accept the mails for.
# postconf | grep mydestination
    The output shows the list of the domains that postfix accepts mails for. After defining the SmartHost postfix will forward all the mails to the SmartHost server which are not destined to $mydestination.
# vim /etc/postfix/main.cf
relayhost = smarthost.server.com
    In this scenario postfix forwards all the mails that are not destined local to smarthost.server.com.
Note: In this case the postfix will perform DNS MX record query to the domain smarthost.server.com. Adding square brackets “[]” will skip the MX record query and delivers the msgs directly.
eg: relay_host = [mail1.smarthost.server.com]
eg, for different ports
relayhost = 5.9.240.232:2525 
# postconf |grep relayhost
# postfix reload
Verify the configuration and reload the postfix service
    Test the configuration by sending mails to outside using this Local Server.Examine the Logs in the Local server as well as in the SmartHost server.

Routing all mails for a specific domain to a smarthost :

Note: The information below relates to a very specific customer requirement and is not recommended for most deployments. A configuration like this can cause problems which will be hard to troubleshoot. Unless you are sure you need to use this setup, please explore the other available options for routing mail.

Add a line to /etc/postfix/transport:

example.com smtp:mxsrv1.spamgateway.comodo.com:587



generate a postmap file :

postmap hash:/etc/postfix/transport

To use the transport file, add or edit a line in /etc/postfix/main.cf:

transport_maps = hash:/etc/postfix/transport


Restart Postfix and all mail. The mail for selected domains should go trough the Smarthost.

No comments:

Post a Comment