[Mimedefang] filter_recipient problem (bug?)
Egor Moskvichev
jugr at mail.ru
Wed Aug 11 06:46:27 EDT 2004
Huge thanks for your advice!
I have read all man pages concerning this case and realized my mistake.
So the result you can see here. Is it fine?
sub filter_begin () {
$email_from = $RelayAddr;
$email_time = scalar(localtime);
$email_size = -s "./INPUTMSG";
open(LOG, ">> /var/log/mailstats");
foreach (@Recipients) {
$email_recipient = $_;
printf LOG "%-25s %-15s %-50s %s\n", ($email_time, $email_from,
$email_recipient, $email_size);
};
close(LOG);
};
Egor Moskvichev
----- Original Message -----
From: "Jan Pieter Cornet" <johnpc at xs4all.nl>
To: <mimedefang at lists.roaringpenguin.com>
Sent: Wednesday, August 11, 2004 5:57 PM
Subject: Re: [Mimedefang] filter_recipient problem (bug?)
> On Wed, Aug 11, 2004 at 05:07:39PM +0800, Egor Moskvichev wrote:
> > Hi, all!
> > The problem is...
> > Sometimes filter_recipient sub does not return recipient email address
and
> > sender ip-address.
>
> No, it always does. The problem is the variable doesn't survive between
> a call to filter_recipient and filter_begin. They are very often not
> run in the same perl process.
>
> See also the section "MAINTAINING STATE" in mimedefang-filter(5).
>
> However, the solution is simple, as the information you are looking for
> is also available in globals set by mimedefang. See the section
> "GLOBAL VARIABLES SET BY MIMEDEFANG.PL" in mimedefang-filter(5).
> Specifically, you need $RelayAddr (instead of $ip/$from_host)
> and the @Recipients array (instead of $to_recipient).
>
> You do realize a single email can be sent to multiple recipients,
> right? Your current code doesn't really handle that gracefully.
More information about the MIMEDefang
mailing list