Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


How to configure postfix to forward mail to exchange server.

Posted on 2009-02-22
Medium Priority
Last Modified: 2013-11-10

I setup a FreeBSD mail server in front of my exchange server for mail filtering.
So please explain step by step how to configure postfix to forward only inbound mail to exchange.
Question by:jacksch4820
  • 3
  • 2
LVL 25

Expert Comment

ID: 23705688
so it ONLY handles incoming email?  outbound goes straight from the exchange server or relays back to the postfix server?

if it only handles incoming, its easy, just add this to the main.cf

relayhost=<<fqdn or IP of exchange>>
relay_domains=<<domain name>>

if exchange relays back, then you'll add this instead

relay_domains=<<domain name>>
my_networks=<<what is there now>>,<<ip of exchange>>

then in the transport file you add this

<<domain name>>:  <<fqdn or IP of exchange>>

then delete the old transport.db and restart postfix.  It should auto-recreate the transport hash file for you then.  To do it manually, you use postmap.

Author Comment

ID: 23705779
Yes only handles incoming email outbound goes straight from exchange server out to external.

relay_domains=<<domain name>> what domain name

I have a windows server 2003 domain  zentura.local
My external MX record is mail.zentuar.com
My exchange has two recipient policy default on zentuar.local and one I had zentuar.com
And will postfix accept inbound mail or what must I add on postfix to accept mail from external.
 Please explain.
LVL 25

Expert Comment

ID: 23705925
it would be zentuar.com.  You put in that list whatever is after the @ in the email.  

mail.zentuar.com should be pointed to the public IP used for the postfix server.  Oh, and check that inet_interfaces is set to all in main.cf as well because by default it only listens on the loopback interface.  This will ensure email can get to the postfix server and the other config options I gave earlier will ensure it gets forwarded to exchange properly.
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 23708583
Hi Cyclops3590

My virus wall will forward all incoming traffic to FreeBSD mail server.
So when I add this config in my postfix.main.cf
All incoming traffic is accepted by postfix and routed to exchange server

relayhost = ip of exchange server
relay_domains = zentura.com
inet_interfaces = all
LVL 25

Accepted Solution

Cyclops3590 earned 1500 total points
ID: 23713349
yes.  I'm not a 100%, but you might even be able to leave the relay_domains part off the config.  I can't remember for sure, but having it in there won't hurt.

however, one change, its probably better to do this for relay_domains
relay_domains=$mydestination, zentura.com

This way it will relay for whatever is listed in the mydestination parameter as well which it does by default.
LVL 19

Expert Comment

ID: 23812615
abc.com and def.com must not be listed in mydestination.

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The core idea of this article is to make you acquainted with the best way in which you can export Exchange mailbox to PST format.
Phishing emails are a popular malware delivery vehicle for attack.  While there are many ways for an attacker to increase the chances of success for their phishing emails, one of the most effective methods involves spoofing the message to appear to …
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
In this video we show how to create a Shared Mailbox in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Recipients >> Sha…
Suggested Courses
Course of the Month10 days, 8 hours left to enroll

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question