• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Apple Mail - Sending to multiple recipients
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Apple Mail - Sending to multiple recipients


  • Subject: Apple Mail - Sending to multiple recipients
  • From: Simon Topliss <email@hidden>
  • Date: Sat, 12 Jan 2013 14:52:34 +0000

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.

I've tried building the list outside of Mail with raw syntax like this:

--------------------------------------------------------------
on addTestData()
repeat with i from 1 to 1000
set end of kEmailRec's _to to {«class radd»:"<test" & i & "@example.com>"}
end repeat
end addTestData
--------------------------------------------------------------

And then setting the 'to recipients' in one go like this:

--------------------------------------------------------------
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
set to recipients to s's kEmailRec's _to
set visible to true
end tell
activate
end tell
--------------------------------------------------------------

But that errors with "Mail got an error: Can’t make {{address:"<email@hidden>"}, {address:"<email@hidden>"}, …etc} into type to recipient." That's probably because I'm setting the 'to recipients' as a list of properties, rather than a list of 'to recipients'.

Any ideas?

Simon

 _______________________________________________
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

  • Follow-Ups:
    • Re: Apple Mail - Sending to multiple recipients
      • From: John <email@hidden>
    • Re: Apple Mail - Sending to multiple recipients
      • From: "koenig.yvan" <email@hidden>
  • Prev by Date: Re: Automating Receive Emails
  • Next by Date: Re: Apple Mail - Sending to multiple recipients
  • Previous by thread: Re: speak text of email
  • Next by thread: Re: Apple Mail - Sending to multiple recipients
  • Index(es):
    • Date
    • Thread