On 2008-10-16 21:55:01 +0100, Steve Kemp wrote:
>   This means right now, without modifying rcpt_ok, I'm out of luck.  I can
>  update recipient_foo to change the recipients only in a different stage
>  of the SMTP transaction.
> 
>   (e.g. Like the "alias_rewrite" plugin[0] I can do the testing at
>  RCPT stage, and rewrite the transaction's recipients() list in
>  the DATA stage - but that doesn't allow me to work with a vanilla
>  rcpt_ok plugin.)

"A" rcpt_ok plugin? Is there more than one?

I always found the rcpt_ok plugin in trunk/plugins rather useless for
two reasons:

1) it can only check for the recipient domain, not the local part. So it
   cannot reject mails to non-existent recipients. Accepting a mail and
   later sending a DSN is IMHO not acceptable behaviour for an MX.

2) It returns OK on success. That means that any later plugins in the rcpt
   hook will not be executed. But most plugins I only want to run after
   I have established that the recipient is indeed a valid, local
   adress.

So I'm using a different model:

The very first plugin in the rcpt hook is aliases_check, which checks that
the recipient address is valid (and sets some notes used by later
plugins). If the recipient is valid, it returns DECLINED, otherwise
DENY.

Then there are several other plugins which do checks depending on the
recipient (greylisting, DNSBLs, etc.). Each of them returns DENY (or
DENYSOFT) if it doesn't like the recipient, otherwise DECLINED.

Finally, if we are through with all the plugins, we know that we have a
valid recipient which passed all the tests. So the last plugin
(contrib/hjp/rcpt_accept) just unconditionally returns OK.


>   Ideally I'd like to be able to modify the recipient prior
>  to subsequent hook_rcpt calls - is that possible?  I've looked around
>  over the source but I can't see a simple method of doing

I like having the original recipient(s) during later rcpt calls and in
data_post. That's why aliases_rewrite is only called late in data_post
(I've been thinking about changing it to be called early in queue
instead - not sure what's more logical).

        hp

-- 
   _  | Peter J. Holzer    | Openmoko has already embedded
|_|_) | Sysadmin WSR       | voting system.
| |   | [EMAIL PROTECTED]         | Named "If you want it -- write it"
__/   | http://www.hjp.at/ |  -- Ilja O. on [EMAIL PROTECTED]

Attachment: signature.asc
Description: Digital signature

Reply via email to