Re: help scripting apple mail
Re: help scripting apple mail
- Subject: Re: help scripting apple mail
- From: Axel Luttgens <email@hidden>
- Date: Sat, 23 Jun 2007 13:33:35 +0200
On 22/06/07 21:06, Bob Cuilla wrote:
I have three .Mac accounts, Grapes,Oranges and Lemons. I would like
to AS the following.
1. Select account "Lemons"
2. Build a list that contains the message bodies in that list
For example, if lemons had four emails, whose messages were Green
grass, blue skies, yellow daisy and pink panther, respectively, I
would like the list to contain
green grass
blue skies
yellow daisy
pink panther
Can anyone give me a kick-start on this?
Hello Bob,
It seems Mail doesn't provide a direct access to a message's body.
So, perhaps could you try somthing like this:
set Bodies to {}
set TID to AppleScript's text item delimiters
set AppleScript's text item delimiters to {"
"}
tell application "Mail"
tell account "axlut4"
tell mailbox "INBOX"
repeat with M in messages
-- Get the message's raw contents
set S to source of M
-- Split the message on "empty lines": the first
-- one separates the header from the body
set S to text items of S
-- Remove the header
set S to items 2 thru -1 of S
-- Re-build the body
set S to S as string
-- Save the body
set end of Bodies to S
end repeat
end tell
end tell
end tell
set AppleScript's text item delimiters to TID
HTH,
Axel
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden