Delays to outgoing messages from Exchange 2003 using Postfix MTA

posted 13 Jun 2011, 07:38 by Tristan Self

Was getting the problem that mails were being delayed from Exchange when sending outbound via a Postfix SMTP relay.

After much work to try to determine the issue, I discovered that the Postfix server was responding with 400 errors for domains that did not exist or for

domains that didn't even have MX records. I found this by checking the SMTP logs on the Exchange server.

As soon as Postfix responded with a 400 error for a mail, Exchange seemed to freak out and let its queues grow.

So what I was finding was the mails were backing up then SMTP would stall, restarting the SMTP service on Exchange would fix the problem for a bit, but then

it would come back.

By changing the postfix configuration as follows I was able to resolve the problem by telling Postfix to bounce mail to domain that didn't exisit rather than

tell Exchange to keep trying (which seems to be its default setting.)

# What to do with error emails.
soft_bounce = no
#unknown_local_recipient_reject_code = 550
unknown_address_reject_code = 554
#unknown_client_reject_code = 550
unknown_hostname_reject_code = 554
unknown_relay_recipient_reject_code = 550
#unknown_virtual_alias_reject_code = 550
#unknown_virtual_mailbox_reject_code = 550
#unverified_recipient_reject_code = 550
#unverified_sender_reject_code = 550

I applied this code to the config, then restarted the postfix service and forced the connection from the Exchange 2003 server and volia, the messages started

to flow out, and the messages that were going to incorrectly spelt or unknown domains were bounced-back, rather than trying to keep being delivered over and

over again.