On Tue May 04, 2010 at 23:47:04 -0400, Chris Lewis wrote:

> Very old version of qpsmtpd, but this should still be more-or-less the same.
>
> I'm trying to substitute a recipient address very early on in processing
> so that every subsequent plugin sees the new value.

  This is code I'm using here:

    http://www.steve.org.uk/Software/qpsmtpd/spam_gourmet/


sub hook_rcpt
{
    my ( $self, $transaction ) = ( shift, shift );

    #
    #  The user + domain the message is delivered to.
    #
    my $user   = $_[0]->user();
    my $domain = $_[0]->host();

    ##
    ## Upper-case for testing.
    ##
    my $real = uc($user);

    if ( defined($real) && ( $real ne $user ) )
    {

        # used for logging
        my $old = "<" . $user . '@' . $domain . ">";
        my $new = "<" . $real . '@' . $domain . ">";

        # replace the address.
        $_[0] = Qpsmtpd::Address->new($new);

        # log
        $self->log( LOGWARN, "spam_gourmet: replaced $old with $new" );
    }

    #
    #  OK, we're going to accept the mail, with the rewritten destination
    # address.
    #
    return DECLINED;
}


   I hope that helps.  It was based upon a thread in the archive
 a while back but I cannot immediately find the discussion link, even
 though I started it by asking a question similar to yours!


Steve
--
Let me steal your soul?
http://stolen-souls.com

Reply via email to