On Sat, Dec 22, 2001 at 02:26:49AM -0600, Jeffrey Taylor wrote:
> if ( lookup($FROM, "members-white-list")
> {
> ...
> }
>
> Try "man maildropfilter" and search for lookup for another way to do
> it. As an earlier post told you, your code is looking up asterisk in
> the files. And it's not there.
>
Here follows everything the man page has to say about lookup:
lookup (expr, 'filename', 'options') - read file for patterns
expr is any expression. filename is a name of a file con�
taining a list of patterns. Please note that filename is
relative to the current directory, which is the home
directory of the user when maildrop runs in delivery mode,
or embedded mode. maildrop will read the file. Blank lines
will be ignored, as well as any lines that begin with the
# character (comments).
Leading whitespace (but not trailing whitespace, take
care) is removed, and the remaining contents of each line
are interpreted as a pattern which is matched against
expr. As soon as the match is found, lookup returns "1".
If no match is found after reading the entire file, lookup
returns "0". For example:
if ( /^To: *!.*/ && lookup( $MATCH2, "badto.dat" )
{
exit
}
And the file badto.dat contains the following two lines:
friend@public
^[^@]*$
If a message has a To: header that contains the text
"friend@public", or does not contain at least one @ char�
acter, then the message will be silently dropped on the
floor ( maildrop will terminate without delivering the
message anywhere).
options are the pattern matching options to use. The only
supported option is "D" (the rest are meaningless, in this
case).
NOTE: be careful with discarding messages like that. Pat�
tern matching can be tricky, and a slight miscalculation
can cause mail to be unintentionally discarded. It is much
desirable to first deliver message to a separate folder or
mailbox, and once the filter is verified to work cor�
rectly, change it so the messages are discarded com�
pletely.
In embedded mode, the lookup() function is restricted as
follows. The name of the file may not begin with a slash,
or contain periods. Furthermore, ".mailfilters/.lists/" is
automatically prepended to the filename. When writing fil�
tering recipes that go into $HOME/.mailfilters, please
keep in mind that any files loaded by the lookup() func�
tion must be placed in $HOME/.mailfilters/.lists.
I'm not seeing an alternative method here.
The earlier response about expr being set by the MTA makes sense if
you let fetchmail follow the default procedure of invoking your MTA to
deliver received mail. It would be relatively straightforward for
maildrop to compare the contents of a variable to each line in a file
looking for a match.
But invoking the MTA to deliver retrieved mail caused me some grief a
while ago. I don't remember what the problem was, but I don't do this
anymore. I call maildrop directly from fetchmail.
Of course the bad news is that fetchmail doesn't set a variable I can
use for expr.
And the thing is, I don't really care where in the headers the pattern
found in the file matches. If the e-mail address in the file is
there, anywhere in the headers, I want the test to succeed. But if I
have to choose something, I guess the From: address will work.
So I guess I need to extract that From: address. How do I do this?
> > On Fri, Dec 21, 2001 at 11:23:14PM +0100, Roland Schneider wrote:
> > >
> > > This fails because you dont have a line with '*' in the lists.
> > > Use VERBOSE=9 and logfile().
Like this?
VERBOSE=9
logfile maildrop.log
I put these statements at the beginning of .mailfilter. I can't say
it's really helping. What I get in maildrop.log is:
Date: Sat Dec 22 02:02:21 2001
From: [EMAIL PROTECTED] (Cron Daemon)
Subj: Cron <benfell@home> ~/scripts/fetchmail
File: /home/benfell/Mail/cron/
(6962)
Date: Sat Dec 22 02:02:21 2001
From: [EMAIL PROTECTED]
Subj: Re: [courier-users] Re
File: /home/benfell/Mail/users/
(2223)
Date: Sat Dec 22 02:07:20 2001
From: [EMAIL PROTECTED] (Cron Daemon)
Subj: Cron <root@home> /var/qmail/bin/qmHandle -l
File: /home/benfell/Mail/cron/
(1242)
Date: Sat Dec 22 02:07:20 2001
From: [EMAIL PROTECTED] (Cron Daemon)
Subj: Cron <benfell@home> ~/scripts/fetchmail
File: /home/benfell/Mail/cron/
(7161)
Date: Sat Dec 22 02:17:19 2001
From: [EMAIL PROTECTED] (Cron Daemon)
Subj: Cron <benfell@home> /usr/bin/rsync -au -e /usr/local/bin/ssh
earth:/home
File: /home/benfell/Mail/cron/
(1062)
Date: Sat Dec 22 02:17:20 2001
From: "Rogier Maas" <[EMAIL PROTECTED]>
Subj: Re: [SLE] Bash-script simple question
File: /home/benfell/Mail/users/
(2458)
None of the above should match on the lookup invocation I'm testing,
so these were all properly handled. I sent a test e-mail to an
address, [EMAIL PROTECTED], which should match. And I saw this:
Date: Sat Dec 22 02:17:20 2001
From: David Benfell <[EMAIL PROTECTED]>
Subj: test message
File: /home/benfell/Mail/suspect/
(2687)
I realize this is all really obvious to you all, but I don't get it.
And, as usual, the man pages really only help if you already know what
you're looking for. So instead of just telling me to RTFM, can
someone please offer a real explanation?
Thanks!
--
David Benfell, LCP
[EMAIL PROTECTED]
---
Resume available at http://www.parts-unknown.org/resume.html
msg00609/pgp00000.pgp
Description: PGP signature
