June 2001
Intermediate to advanced
526 pages
16h 29m
English
You can use an AppleScript to find
out information about an account. To do this, you
need to get references to the Mail application’s
account elements. For example, the code fragment:
tell app "Mail" to get accounts returns a list
type containing Mail account objects.
Finally, Example 33-3 shows how to set up and send an email with Mail and Mac OS X. Mail’s send command returns 1 if the mail was sent and if the send failed.
tell application "Mail"
activate
set theContent to "Here's my first Mac OS X email message!"
set email to (make new compose message at the beginning of¬
compose messages with properties {content:theContent,¬
tell email to make new to recipient at beginning of to recipients¬
make new message editor at the beginning of message editors
set the compose message of message editor 1 to email
send email
end tellRead now
Unlock full access