Hi all,
Does anyone have any tips on how to speed up creating a "to recipient" list in Mail?
The following script takes about 2 minutes to create a new message for 500 recipients and about 8 minutes to create 1000 recipients. I need to be able to create a new message for 4000+ recipients but it takes way too long to be practical as things stand.
--------------------------------------------------------------
script s
property kEmailRec : missing value
on init()
set kEmailRec to ¬
{_subject:"This is the subject" as text ¬
, _body:"This is the body" as text ¬
, _to:{} ¬
}
end init
on addTestData()
repeat with i from 1 to 1000
set end of kEmailRec's _to to {"<test" & i & "@example.com>"} end repeat
end addTestData
end script
s's init()
s's addTestData()
tell application "Mail"
set newMessage to make new outgoing message with properties {subject:s's kEmailRec's _subject, content:s's kEmailRec's _body & return & return}
tell newMessage
repeat with i from 1 to s's kEmailRec's _to's length
make new to recipient at end of to recipients with properties {address:item i of s's kEmailRec's _to}
end repeat
set visible to true
end tell
activate
end tell
--------------------------------------------------------------
I've tried the usual 'repeating with a script object's property' but it didn't make much difference.
I suspect that the slowness is due to having to send an Apple Event every time to 'make new recipient at end' in the repeat loop.