[REBOL] Re: Need help with email program
From: ingo:2b1 at: 12-Nov-2001 20:36
Hi Koie,
Once upon a time mechtn spoketh thus:
<...>
> connecting to: mail.tkweb.net
> ** Script Error: find expected series argument of type: series port bitset
> ** Where: forall
> ** Near: if find mail/subject word [
> print ["Found in:" mail/from mail/subject]
> write/append %/C/rebol/remove.txt mail/from
> write/append %/C/rebol/remove.txt ","
> inbox: remove inbox
> break
> ]
OK, let's walk throufg it step by step:
The error states, that find is expecting a series (...) but didn't
get one, now where can this be? 'word should be correctly set, and
from your post I conclude, it's unchanged from the other version.
So, we'll have to inspect 'mail/subject, this is the subject, of
the imported email. How could this be not a series?
Let's have a look into import-email:
>> probe import-email {from: me
{
{ hi
{ }
make object! [
To: none
CC: none
BCC: [ingo--2b1--de]
From: [me]
Reply-To: none
Date: none
Subject: none
Return-Path: none
Organization: none
Message-Id: none
Comment: none
X-REBOL: "1.2.1.4.2 http://WWW.REBOL.COM"
MIME-Version: none
Content-Type: none
Content: "hi^/"
]
>>
Got it? If the subject isn't set in the email, the email object
contains 'none, instead of a string, and find can't handle this.
<...>
> forall inbox [
> mail: import-email first inbox
> foreach word word-list [
> if find mail/subject word [
; change this line to
if all [ not none? mail/subject find mail/subject word] [
; now the find will only be run, when the subject is not equal to 'none.
> print ["Found in:" mail/from mail/subject]
> write/append %/C/rebol/remove.txt mail/from
> write/append %/C/rebol/remove.txt ","
> inbox: remove inbox
> break
> ]
> ]
> ]
I hope that clarifies it a bit,
Ingo