Hi,

This is my first post on this list. I'm also a qpsmtpd beginner (you'll be warned ).

I'm trying to write a plugin changing the sender e-mail address.

One automated system on my computer send mail in the form [EMAIL PROTECTED] name}.{domain name} Unfortunately, my system name isn't known in public DNS (and this is not a good solution for me anyway).

So I had the feeling that a qpsmtpd plugin could be a solution (even if this is not the primary goal of this -great- tool).

More generally, I didn't find much information about the way to alter the header of the mail, any hints ?

Here is my (non working !) plugin proto :
--------------------------------------------------------------------------------------------
#!/usr/bin/perl -w
# this plugin should (!) rewrite the sender address in some precise conditions

sub hook_mail {
 my ($self, $transaction, $sender) = @_;
 # how can we catch the sender ?
 my $newsender  = $self->qp->transaction->sender || $sender;
 my $origsender = $newsender;
if ( $newsender =~ s/^(.*FETCHMAIL-DAEMON\@).+\.(schirrms\.net.*)$/$1$2/xms ) {
   $transaction->header( 'From', Qpsmtpd::Address->new( $newsender ) );
   return (DECLINED, "$origsender REWRITE TO $newsender");
 }
 return (DECLINED, "$origsender");
}
-------------------------------------------------
The plug is running, the return message tell me that $newsender is rewritten as expected, but next plugins still use $origsender. I have to install my plug very early in the run, before require_resolvable_fromhost.

My system is a SME 7 server (well known from some people here ;-). I didn't do any significant change in qpsmtpd before this one.

Thanks for any help or links or hints.
Pascal

Reply via email to