This is an another way of enabling relaying in postfix. By default Postfix will relay mails for the domains that specified in the "mydestination" derivatives (Postfix considers the mail that are originated locally). If we need to add more domains to be relayed through the same server we can user "relay_domains" as well as "mydestination" derivatives.
By default "relay_domains" will be configured with mydestination.
i.e,
relay_domains = $mydestination
For example:
# vim main.cf
relay_domains = $mydestination, new1domain.com, new2nd.domain.com
# smtpd_client_restrictions =
# postfix reload
# ps -ef |grep master
Note: All the subdomains will be relayed if a domain is specified in "relay_domains". For eg:- if newdomain.com is specified then postfix server will allow relaying all the subdomains like host1.newdomain.com, host2.newdomain.com etc.
Relay Domains with Maps
Enabling the maps makes MTA to query the data from a database machanism. If a server is hosting many domains and practically entering each domain name in the configuration file is not possible, then we can use database maps for fast query and easier management.
Defining Rlay_domains Maps
# rpm -qa |grep db
# vim /etc/postfix/main.cf
relay_domains = $mydestination, hash:/etc/postfix/relaydomains
# vim /etc/postfix/relaydomains
domain1.com
domain2.com
domain3.com
domain4.com
domain5.com
# postmap /etc/postfix/relaydomains
Note: The postmap utility will show error while running. It is because postmap expects the keys and values. The map file consist of keys and values separated with a white space. In our case we have only mentioned the keys. In a db map file Postmap expects the values for each key at right hand side. In this case the error is ignorable because this is the rare case that postfix will not read the "values" in the right hand side. Even if it shows the error the db file will be created.
# postfix reload
#ps -ef |grep master
No comments:
Post a Comment
tag ur valuable ideas below