Here is an AppleScript I wrote to create a digest from any number of
selected emails.
-- Begin AppleScript
-- Combine emails into a digest
-- This script takes any number of email messages an puts them into a digest
--
-- By Wayne Brissette
-- 2007-08-09
set AppleScript's text item delimiters to {""}
set TID to AppleScript's text item delimiters
set MySenderAddress to {}
set MySenderName to {}
set MySubject to {}
set MyContents to {}
set MyMessageDate to {}
set mydivider to return & "------------------------------" & return
set MessageIndex to ""
set MessageBody to ""
set mycount to 0
set dateTid to "Date: "
try
tell application "PowerMail"
set MyMessage to current messages
repeat with i in MyMessage
set TheSender to (sender of i)
set TheSenderAddress to (email address of TheSender)
set TheSenderName to (display name of TheSender)
set TheSubject to (subject of i)
set TheHeaders to (headers of i)
set theContents to (content of i)
(* Build the date field *)
set tempHeader to (headers of i)
set AppleScript's text item delimiters to dateTid
set TheDate1 to text item 2 of tempHeader
set AppleScript's text item delimiters to return
set TheDate to text item 1 of TheDate1
set AppleScript's text item delimiters to TID
(* Put into groups here *)
set MySenderAddress to MySenderAddress &
TheSenderAddress as list
set MySenderName to MySenderName & TheSenderName as list
set MySubject to MySubject & TheSubject as list
set MyContents to MyContents & theContents as list
set MyMessageDate to MyMessageDate & TheDate as list
end repeat
end tell
(* Build Email *)
set myrevcount to count of items in MySenderAddress
repeat with i in MySenderAddress
set mycount to mycount + 1
set Newcount to mycount as text
set MessageIndex to MessageIndex & Newcount & ". " & item
myrevcount
of MySubject & return & " " & item myrevcount of MySenderName & " <"
& item myrevcount of MySenderAddress & ">" & return & return
set MessageBody to MessageBody & mydivider & return & "From: "
& item
myrevcount of MySenderName & " <" & item myrevcount of MySenderAddress &
">" & return & "Subject: " & item myrevcount of MySubject & return &
"Date: " & item myrevcount of MyMessageDate & return & return & item
myrevcount of MyContents & return
set myrevcount to (myrevcount - 1)
end repeat
set MyContents to "Index of Messages" & return & return & MessageIndex
& return & MessageBody
(* put into a new message *)
tell application "PowerMail"
set msg to make new message with properties {content:MyContents}
open msg
activate
end tell
on error
set AppleScript's text item delimiters to TID
end try
-- end AppleScript
--
"Somebody's dead forever..."
- Somebody Got Murdered -- Joe Strummer (1952-2002)