Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

sammyman

macrumors 6502a
Original poster
Mar 21, 2005
998
65
I wanted to know how to write a simple script that would automatically send an email from iCal. I just noticed one of the options for an alarm was a script. See, I organize people to teach weekly lessons, and would like to email the teacher one week in advance automatically from iCal. I have the topic for the lesson, and can write the emails now, but want them to be emailed with a script. Can anyone show me how to do this?
 
There are sample scripts on your system at:

MacHD:Library:Scripts:Mail Scripts:

Here's the quick and dirty.

tell application "Mail"
set newMessage to make new outgoing message with properties {subject:theSubject, content:theBody}
tell newMessage
make new to recipient at end of to recipients with properties {name:theName, address:theAddress}
end tell
send newMessage
end tell
 
Would it be possible to have the email subject be the title of the iCal event? Thanks for the code above, BTW... I am testing it now.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.