Title: Re: Applescript troubles
On 5/20/04 6:22 PM, "Scott Haneda" <[EMAIL PROTECTED]> wrote:
> I use this applescript...
>
> tell application "Microsoft Entourage"
> set msgList to current messages
> repeat with oneMsg in msgList
> if address of address of (first recipient of oneMsg) does not start
> with "postmaster@" then
> set theFwd to forward oneMsg to "[EMAIL PROTECTED]" without
> opening window
> send theFwd with sending later
> end if
> move oneMsg to folder id 6
> end repeat
> end tell
>
> Today, when I ran the script, on a message I get the following error:
>
> MS Entourage got and error: Can't get address of address of recipient 1 of
> incoming message id 47741.
>
> Here are the headers of the email in question, this has happened 2 times
> now.
>
> Return-Path: <[EMAIL PROTECTED]>
> Received: from home.nl (219.144.236.237) by hostwizard.com with SMTP
> (Eudora Internet Mail Server 3.2.4) for <[EMAIL PROTECTED]>;
> Thu, 20 May 2004 18:05:21 -0700
> Message-ID: <[EMAIL PROTECTED]>
> From: "Kimberly B. Adams" <[EMAIL PROTECTED]>
> Subject: bigger wiener
> Date: Fri, 21 May 2004 01:05:20 +0000
> MIME-Version: 1.0
> Content-Type: text/html
> Content-Transfer-Encoding: 7bit
I don't see any "To:" header. Presumably someone bcc'd you (and 10,000 other people) without supplying any "To:" recipient. So there's no 'first recipient' of this message. Therefore " MS Entourage got an error: Can't get address of address of recipient 1 of incoming message id 47741".
If you want to assume that _any_ message that has no To or Cc recipient is also crap that should be sent to the Junk folder without forwarding to ubesameples , do this:
tell application "Microsoft Entourage"
set msgList to current messages
repeat with oneMsg in msgList
try
if address of address of (first recipient of oneMsg) does not start with "postmaster@" then
set theFwd to forward oneMsg to "[EMAIL PROTECTED]" without opening window
send theFwd with sending later
end if
end try
move oneMsg to folder id 6
end repeat
end tell
-------------
or if you want to play it safe and forward these dubious messages on, then:
tell application "Microsoft Entourage"
set msgList to current messages
repeat with oneMsg in msgList
try
if address of address of (first recipient of oneMsg) does not start with "postmaster@" then
set theFwd to forward oneMsg to "[EMAIL PROTECTED]" without opening window
send theFwd with sending later
end if
on error
try
set theFwd to forward oneMsg to "[EMAIL PROTECTED]" without opening window
send theFwd with sending later
end try
end try
move oneMsg to folder id 6
end repeat
end tell
--
Paul Berkowitz
- Applescript troubles Scott Haneda
- Re: Applescript troubles Paul Berkowitz
- Re: Applescript troubles Scott Haneda
