
Now you are ready to extract a list of valid recipients from Exchange in the proper format for a relay recipient map, copy that file to the mail gateway, create the indexed map and load it. Then reload Postfix using the postfix reload command.Ĭonfiguring Valid Recipients from Exchange Prevent Postfix from starting the local delivery agent by commenting out the local service (the line beginning with “local”) in the master.cf configuration file.Virtual_alias_maps = hash:/etc/postfix/virtual

Add the required configuration in main.cf like this:.Postmaster Build the indexed map using the command: A typical name for such a map is “virtual”, which might make the complete pathname to the file /etc/postfix/virtual.To do this, you must set the virtual_aliases_maps parameter, create the corresponding file with name/value pairs, and build an indexed map from it. RFC2412 suggests many standard addresses for various functions, most of which are either suggested or mandated by other RFCs, e.g. Forward any required local recipients to internal addresses.

Since the intent is to disable local delivery, any messages sent from local process would appear to come from this host, making it impossible to reply to them (which you probably don’t want anyway, but it could cause confusion). Make sure myorigin is set to your internal domain(s).Make local_recipient_maps empty to disable delivery to local mailboxes.Any domains listed here should now be in listed relay_domains. If you have mydestination configured, make it empty so that Postfix is not a final destination for mail.Configure relay_domains to match the domains for which this host should relay mail to an inside host:.) prior to beginning your edits as outlined in the steps below. Unless otherwise noted, all the parameters are in main.cf (typically in /etc/postfix). Initial SetupĪ rather simple configuration for Postfix as a mail gateway (aka relay or “smarthost”) will relay all mail for your domain to the internal SMTP server. Links to the complete new script, the configuration file, and shell script for automated processing on the mail gateway are provided below. SpamAssassin, you will definitely want to restrict forwarding for invalid recipients at your mail gateway.Ĭhris Covington provided a simple perl script that served as a starting point, but this will be extended with additional and important functionality. Even if you use the first option, you still may want to employ the method below for defense-in-depth, but if you don’t and you run your own filtering service, e.g. Not all senders will honor your DNS MX resource records, so this is still necessary! Reject all other SMTP connections through the MTA configuration on your mail gateway, or at your firewall.Give that service a definitive list of valid e-mail addresses so that mail addressed to invalid addresses can be rejected there.

