Re: Checking from an external file?

Milan Obuch <[email protected]> Mon, 19 May 2025 07:46:24 +0200
Newsgroups gmane.mail.maildrop
Message-ID <[email protected]>
On Mon, 19 May 2025 14:09:13 +1000, Philip Rhoades via Courier-maildrop
<[email protected]> wrote:

> Milan,
> 
> On 2025-05-18 18:44, Milan Obuch wrote:

[ snip ]

> OK, I have:
> 
> - Created a new usr "tst"
> 
> - Copied .mailfilter from "phr" and deleted all of phr's custom stuff
> 
> - Successfully mailed from GMail to tst and done local maildrop
> emails to tst.
> 
> However, after having added your code (and admittedly still not been 
> 100% sure of what I am doing) . . for the attached new .mailfilter
> file (I have changed the ownership to phr so I can upload it) I am
> getting:
> 
> [tst@pricom ~]$ maildrop ~tst/.mailfilter < ~tst/Maildir/tmd_00.txt # 
> which usually works
> /home/tst/.mailfilter(151): Syntax error.
> 
> So I must have syntax errors or I am still missing stuff . .
>

There are two problems in your file I see right now:

151 is line number where to look for syntax error. In your case, this
points to a 'else' statement which has no 'if' condition.

This came from copying blindly my maildrop (partial) recipe, you have

  (gdbmopen('.list.db','N'))

instead of

  if (gdbmopen('.list.db','N'))

which explains the missing 'if'.

Additionally, first line in file you sent is

eteo Global maildrop filter file - see "## PHR" below

and I have no idea where it came from - is it some other copy-paste
error, or you have some 'eteo' local command specific to your system...

I'd expect this one throwing some kind of runtime error after you
correct the first one.

I think you need more experiments to get something out of this. In
particular, I recommend reading 'man maildropfilter', where you can
find 'lookup' function, which can be better suited for your use case (I
don't know whether you like matching the subject exactly, or do some
pattern matching, those are completely different animals and come with
different considerations).

Regards,
Milan