0

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" [email protected]

I receive the email on my mailbox [email protected] from [email protected]

I reply to [email protected] to say hello, and I receive the email on myserverdomain.com.

Then I try this :

mail -s "test mail" [email protected]

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 [email protected], 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.

1
  • Maybe the question is not clear enough, or too much specific?
    – jptsetung
    Jan 25, 2012 at 13:41

1 Answer 1

1

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, [email protected]
  • 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

root: [email protected]

And then patch the alias data and relaunch python

newaliases
postfix reload

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .