Robin Bowes said the following on 26/12/2005 18:25:
> When I try and use this be specifying logging/parseable in
> config/logging, I get the following error when a connection is made to
> the SMTP port:
> 
> @4000000043b034d83ab51744 Can't locate object method "new" via package
> "Qpsmtpd:
> :Plugin::logging::parseable" at lib/Qpsmtpd.pm line 288.
> 
> Any idea what I'm doing wrong?

Hmmm. It seems that one of the main problems was that I was running
under speedycgi and there were some stale processes around that were
running old code when I was testing.

This is now working, sort of.

The "detailed" and "rejected" logs are working OK, but I'm finding the
reset_transaction hook is firing three times. Also, this code is not
getting the sender and recipient details from the message.

A sample log output is as follows:
8133 ++ ,,0,smarthost4.mail.uk.easynet.net,212.135.6.14,no,,
8133 ++
<[EMAIL PROTECTED]>,,16432,smarthost4.mail.uk.easynet.net,212.135.6.14,no,,
8133 ++ ,,0,smarthost4.mail.uk.easynet.net,212.135.6.14,no,,

Only line 2 contains the sender address and size; no lines contain the
recipients.

Any idea why this fires three times? OR why the recipients don't show up?

This is my current code:

sub hook_reset_transaction {    # slog
    my ($self, $transaction, @args) = @_;
    return DECLINED if $self->{_denied};

    my $mail_details = concat_mail_details($self, $transaction);

    warn( ${$} . ' ' .
        $self->{_acceptprefix} . ' ' .
        $mail_details . "\n"
    );

    $self->SUPER::hook_reset_transaction( $transaction, @args );
    return DECLINED;
}

concat_mail_details is a sub as follows:

sub concat_mail_details {
    my ($self, $transaction) = @_;

    # mail sender (if present)
    my $sender = '';
    if ( defined( $transaction->sender ) ) {
        $sender = $transaction->sender->format;
    }

    # mail recipients, if any
    my $recipients = '';
    if ( defined( $transaction->recipients ) ) {
        my $recipients = join ';', $transaction->recipients;
    }

    # message size, if > 0
    my $mail_size = $transaction->body_size || 0;

    # relay client?
    my $relay_client = (
        ( $transaction->{_relaying} || defined( $ENV{RELAYCLIENT} ) )
        ? 'yes'
        : 'no'
    );

    # auth method, if any
    my $auth_method = $self->qp->connection->notes('authmethod') || '';

    # authenticated user, if any
    my $auth_user = $self->qp->connection->notes('authuser') || '';

    # Sender:       $sender
    # Recipients:   $recipients
    # Message size: $mail_size
    # Remote Host:  $self->qp->connection->remote_host
    # Remote IP:    $self->qp->connection->remote_ip
    # Relay Client: $relay_client
    # Auth method:  $auth_method
    # Auth user:    $auth_user;

    return join ",",
        $sender,
        $recipients,
        $mail_size,
        $self->qp->connection->remote_host,
        $self->qp->connection->remote_ip,
        $relay_client,
        $auth_method,
        $auth_user;
};


Thanks,

R.

Reply via email to