Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to build a system that analyzes incoming emails and automatically removes emails that fail permanently. But I never receive those emails that you usually receive when you send an email to an address that is not valid.

To test my system I use the command

mail -s "test mail"

I receive the email on my mailbox from

I reply to to say hello, and I receive the email on

Then I try this :

mail -s "test mail"

And I never receive this email that tells you it's not a valid address.

If I'm sending an email from a "classic" email client (gmail for example) to, I receive almost immediately this email telling me it's not a valid address.

So am I missing something? I think yes.

I'm using Postfix latest version on debian. It's configured on port 6666 (not 25 actually). I'm using another smtp server on the same machine on port 25, it's a python script that receives external emails and analyzes them.

share|improve this question
Maybe the question is not clear enough, or too much specific? – jptsetung Jan 25 '12 at 13:41
up vote 1 down vote accepted

OK, I got it working.

Here is the explanation of what was happening :

  • When I send an email with postfix, postfix contact the smtp server of the domain in the receiver's email address.
  • The SMTP server replies that this account is not valid.
  • Postfix prepares an error email to send to the "return-path" field of the email,
  • Postfix consider this is a local email address so he uses its own SMTP server to send this email. The python SMTP server that I've built to receive emails on this server is bypassed, and I never see this error email in my python script.

To solve this I've added an alias in Postfix configuration : (debian)

vi /etc/aliases

Add this new alias in the file


And then patch the alias data and relaunch python

postfix reload
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.