Getting Information about an Email Account
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 tell
Get AppleScript in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.