Weirdness while parsing Headers in Mail.app
Weirdness while parsing Headers in Mail.app
- Subject: Weirdness while parsing Headers in Mail.app
- From: Jaime Magiera <email@hidden>
- Date: Mon, 3 May 2004 02:10:04 -0400
I've written a simple script to gather the "received" headers of a
message. It's acting really weird though. It properly identifies the
number of "received" headers, but only returns the content of the first
one. Even if I implicitly target a particular received header. Can
anyone explain this? (Yes, I could instead write a text parser, but I'm
curious about this situation):
global receivedHeaderList
set receivedHeaderList to {}
tell application "Mail"
set aMessage to (get message 2 of mailbox "Inbox" of account "SRN")
set theHeaders to (headers of aMessage)
repeat with aHeader in theHeaders
display dialog (name of aHeader as string)
if name of aHeader = "received" then
set receivedHeaderList to receivedHeaderList & (content of aHeader
as string)
end if
end repeat
return receivedHeaderList
end tell
the sample message header:
From: email@hidden
Subject: Web Thoughts
Date: April 5, 2004 7:05:20 PM EDT
To: email@hidden
Return-Path: <email@hidden>
Received: from apollo.sensoryresearch.com ([unix socket]) by
apollo.sensoryresearch.com (Cyrus v2.1.13) with LMTP; Mon, 05 Apr 2004
19:09:33 -0400
Received: from mxsf14.cluster1.charter.net
(mxsf14.cluster1.charter.net [209.225.28.214]) by
mail.sensoryresearch.com (Postfix) with ESMTP id 5BF7D32B741 for
<email@hidden>; Mon, 5 Apr 2004 19:09:33 -0400 (EDT)
Received: from [192.168.1.101] ([24.231.166.62]) by
mxsf14.cluster1.charter.net (8.12.11/8.12.11) with ESMTP id
i35N5eo1022796 for <email@hidden>; Mon, 5 Apr 2004 19:05:55
-0400 (EDT)
X-Sieve: CMU Sieve 2.2
Mime-Version: 1.0 (Apple Message framework v606)
Message-Id: <email@hidden>
Content-Type: multipart/alternative; boundary=Apple-Mail-2--180094083
X-Mailer: Apple Mail (2.606)
the result:
{"from apollo.sensoryresearch.com ([unix socket]) by
apollo.sensoryresearch.com (Cyrus v2.1.13) with LMTP; Mon, 05 Apr 2004
19:09:33 -0400", "from apollo.sensoryresearch.com ([unix socket]) by
apollo.sensoryresearch.com (Cyrus v2.1.13) with LMTP; Mon, 05 Apr 2004
19:09:33 -0400", "from apollo.sensoryresearch.com ([unix socket]) by
apollo.sensoryresearch.com (Cyrus v2.1.13) with LMTP; Mon, 05 Apr 2004
19:09:33 -0400"}
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.