Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Nov 5, 2012, 08:15 AM   #1
eric98
macrumors newbie
 
Join Date: Nov 2012
Apple script, insert email of group in mail

Hi,

I tried to get the email adress of any persons of a group (in adress book) in a new outgoing message.

Did some one have any idea how the apple script should look like?

many thank's for your help
eric98 is offline   0 Reply With Quote
Old Nov 5, 2012, 01:44 PM   #2
kryten2
macrumors 6502a
 
Join Date: Mar 2012
Location: Belgium
An example of a Work group with 2 persons in it. Both of them with a work and home email address.

Code:
set emailList to {}
tell application "Address Book"
	set thePersons to get every person of group "Work"
	repeat with aPerson in thePersons
		set end of emailList to the value of aPerson's email
	end repeat
end tell

tell application "Mail"
	set theMessage to make new outgoing message with properties {visible:true, sender:"me.somewhere@rainbow.com", subject:"Testing", content:"Just testing Mail with Address Book"}
	tell theMessage
		repeat with anItem in emailList
			repeat with anAddressItem in anItem
				make new to recipient at end of to recipients with properties {address:anAddressItem}
			end repeat
		end repeat
	end tell
end tell
Attached Thumbnails
Click image for larger version

Name:	Picture 1.png
Views:	7
Size:	61.5 KB
ID:	375240   Click image for larger version

Name:	Picture 2.png
Views:	6
Size:	61.5 KB
ID:	375241   Click image for larger version

Name:	Picture 7.png
Views:	7
Size:	32.7 KB
ID:	375243  

Click image for larger version

Name:	Picture 8.png
Views:	8
Size:	32.3 KB
ID:	375244  
__________________
Space Corps Directive 34124
kryten2 is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Group email? Bulldog VII Mac Basics and Help 1 Mar 9, 2013 10:16 AM
Can you insert an e-signature in mail caddyshack21 MacBook Pro 3 Feb 15, 2013 12:52 PM
Group Email! Mail Client with Attachments vettori iPhone and iPod touch Apps 0 Oct 24, 2012 07:23 PM
Group Email! Mail Client with Attachments vettori iPad Apps 0 Oct 24, 2012 07:22 PM
Apple Mail keeps denying sending email for all email addresses? Imola Ghost OS X 10.8 Mountain Lion 2 Aug 22, 2012 01:16 AM

Forum Jump

All times are GMT -5. The time now is 05:00 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC