Hi Joe,

On Sat, 30 Dec 2006 05:11:00 +0100
Joe Knall <[EMAIL PROTECTED]> wrote:
> I'm new to qpsmtpd and want a plugin for userdefined black/whitelisting 
> of senders. The plugin should look up in a database if the recipient 
> has listed the current sender and react appropriate (allow, drop, 
> redirect).
> So my question is, is there a hook that provides sender _and_ recipient 
> (hook_mail and hook_rcpt)?
In hook_mail you just have the sender, as no RCPT TO: has been sent at
this point. In hook_rcpt you can get the sender and recipient by
something like this:

sub hook_rcpt {
    my ($self, $transaction, $recipient, %param) = @_;
    my $sender = $transaction->sender;

Both ($sender, $recipient) are Qpsmtpd::Address objects.

> Could someone direct me to a plugin where I can see how other people 
> solve this problem?
One example is the check_badmailfromto plugin. 
I have done this in a different way...e.g. without using hook_mail(): 

http://ankh-morp.org/~vetinari/qpsmtpd/mailfromto_regexp 

... see warning at end of POD, this is old and untested in real life,
for better handling of the constants see the rcpt_regexp plugin in the
same place.

        Hanno

Reply via email to