How to setup a Postfix server to forward to Exchange server

Posted on 2010-09-14
Last Modified: 2013-11-10
I have already asked this but I still cannot get it to work.  What Im trying to do is forward alerts from my nagios server to my exchange server.  The Nagios server has postfix installed and configured but I keep getting this message when sending

<>: host[] said:
    550 5.7.1 Unable to relay (in reply to RCPT TO command)

I followed these steps

But I still cannot get a relay setup correctly for some reason.  Can anyone give me a headsup as to what I may be doing wrong?
Question by:cjameson74
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
  • +2

Expert Comment

ID: 33675755
How is postfix configured? Please post output of "postconf -n"

Have you tried setting postfix to behave as a simple client?


Author Comment

ID: 33675811
No I havent tried setting it as a client, but here are the results of the conf file.  I have tried to telnet to the exchange server and send a test email msg and that went thru....its only when im using mailx it gets bounced

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
config_directory = /etc/postfix
default_transport = error
local_recipient_maps =
mailbox_size_limit = 0
mydestination =,, localhost
myhostname =
mynetworks =
myorigin =
readme_directory = no
recipient_delimiter = +
relay_domains =
relay_transport = error
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = no
transport_maps = hash:/etc/postfix/transport

Expert Comment

ID: 33675840
in your transport file, make sure you the the following line:   smtp:[ip address of your exchange server]
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

LVL 16

Expert Comment

ID: 33675850
Also, run the following from your postfix server and post the results (replace italicized text with valid info):
telnet YourExchangeServer 25
helo PostfixServer
mail from: root@PostFixServer
rcpt to: (like gmail or yahoo)
From: Root
To: You
Subject: Testing Relay
message content

Make sure you don't miss that last line.  (single period)

If you receive the message at your external address, then relaying is working fine and it is a postfix issue.  Otherwise it should give you an error.

LVL 16

Expert Comment

ID: 33675865
Oh... typing too slow.

Here's a thought... do you have an MX record setup for your domain internally?   If postfix is trying to use your public MX, that might be the problem.

Author Comment

ID: 33675877
I have the transport file configured like that already....
Telnet is working just fine
I received the email so it must be something else in postfix config

Author Comment

ID: 33675887
No the MX record is at our hosted site.  
LVL 16

Accepted Solution

Enphyniti earned 500 total points
ID: 33675914
Or just tell your postfix install to use your exchange server as a smarthost:


restart postfix

More info from

# 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 = []
#relayhost = [mailserver.isp.tld]
#relayhost = uucphost
#relayhost = [an.ip.add.ress]

Author Comment

ID: 33675942
Just for reference
I did get a reply here on exchange

root@Monitor:/etc/postfix# telnet 25
Connected to
Escape character is '^]'.
220 Microsoft ESMTP MAIL Service ready at Tue, 14 Sep 2010 14:24:55 -0500
250 Hello []
250 2.1.0 Sender OK
250 2.1.5 Recipient OK
354 Start mail input; end with <CRLF>.<CRLF>
Testing relay
250 2.6.0 <> Queued mail for delivery
LVL 10

Expert Comment

ID: 33688935
You need the following (2) entries on your transport file:   smtp:[ip address of your exchange server]   smtp:[ip address of your exchange server]

dont forget to postmap that transport file, restart postfix and try again.
LVL 10

Expert Comment

ID: 33712072
It's been 4 days, how did it go?

Featured Post

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Active Directory Account getting mysteriously locked 13 80
Exchnage ./. Sophos Web Application Firewall 5 24
exchange 2007 5 40
Mail Exchanger (MX) Record 5 41
MS Outlook is a world-class email client application that is mainly used for e-communication globally.  In this article, we will discuss the basic idea about MS Outlook, its advanced features, and types of MS Outlook File formats.
How to resolve IMCEAEX NDRs in Exchange or Exchange Online related to invalid X500 addresses.
In this video we show how to create an Accepted Domain 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 Mail Flow >> Ac…
To show how to create a transport rule 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 Mail Flow >> Rules tab.:  To cr…

730 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