Hi Julien,

On Fri, 26 Sep 2008 12:00:36 +0200
[EMAIL PROTECTED] wrote:
> I'd like to disable spamassassin check for mail coming from relay
> clients. Is there a way to do that with the config file
> /etc/qpsmtpd/plugins without modifying the plugin code ?
Not with a/the config file, but with a simple wrapper plugin.

> So far, I added the following lines to the spamassasin plugin
> code in the hook_data_post function :
> 
>     # no spam check for relay client
>     if ( $self->qp->connection->relay_client ) {
>         $self->log(LOGDEBUG,"No spam check from relay client");
>         return (OK);
>     }
You should return DECLINED here, else no other plugin will be run (like
a virus checker).

[...]
> The code is working. But is there a more elegant way to do that?
[...]
> I am using the debian relase of qpsmtpd.
Hmm... etch or lenny/sid? I'm not sure when the "isa_plugin" was added,
but the etch version is too old for that. For lenny this may work as
"sa_norelay" plugin. Not sure, I've never used the debian packages, just
SVN  checkouts (even if all my systems are debian :))
Use this instead of "spamassassin" in the config file. Arguments and
usage is the same as the original spamassassin plugin.
--------------------
sub init {
    my ($self, $qp, @args) = @_;
    $self->isa_plugin("spamassassin");
}

sub hook_data_post {
    my ($self, $transaction) = @_;
    return DECLINED if $self->qp->connection->relay_client;
    return $self->SUPER::hook_data_post($transaction);
}
------------------

        Hanno

Reply via email to