I dug around some more and it looks like Net::SMTP actually has a ->status() method from its superclass Net::Cmd and returns the most significant digit.

I modified my smtp-forward to look at the ->status() flag and return DENY if it's 5, otherwise return DECLINED.

Seems to work well so far. Let me know if anybody is interested in the code - it's a quick ugly hack but made smtp-forward behave much more like a proxy.

Thanks,

Tim

On 09/09/2007 4:57 AM, Tim Tsai wrote:
I have been playing with qpsmtpd in more unusual configurations on personal domains belonging to myself and some friends. I noticed recently that one of the domains has been getting 30-40 spams per SECOND to invalid mailboxes. I am guessing this is from having run qmail before, where qmail-smtpd always accepted an incoming message and if spammers don't check for bounces, will always assume a valid mailbox (one of the main reasons I switched to postfix + qpsmtpd).

Anyway, this particular configuration also runs postfixadmin, a virtual mailbox manager based on MySQL. That is only relevant in that user lookups is somewhat expensive due to SQL query so I would prefer to minimize that.

I was using qpsmtpd as a proxy using smtp-forward and I just discovered that it doesn't actually return the error messages returned from Postfix, at least in my installation. I always get the following if sending e-mail to an invalid mailbox:

    451 Unable to queue message ()

Now, postfix actually returned this:

550 <[EMAIL PROTECTED]>: Recipient address rejected: User unknown in virtual mailbox table

It looks like smtp-forward doesn't bother to look at the return code and always return DECLINED, which I will assume is the 451. I am curious as to why the $! error message never shows up though - is this an issue with Net::SMTP or ? If I could get to the postfix error message, maybe I can modify smtp-forward to just pass-through the Postfix error message (or is that a bad idea?).

Next, I tried postfix-queue (took me awhile to figure out I needed the MASK_EXTERNAL flag). Now, the behavior goes back to what qmail does, which is to allow all recipients and send a bounce later (and then double bounces - yuck). I am going to leave it at this configuration for now.

So the question is, is there a way for me to return 5xx on these messages at the SMTP level given my configuration? I seems to me that if I can get smtp-forward to pass-through the returned error codes it would be ideal, but I am hardly an SMTP guru so your help is much appreciated.

Thanks!

Tim


Reply via email to