DekGenius.com
Team LiB   Previous Section   Next Section

33.3 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.

Example 33-3. Making and Sending an email with AppleScript
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
    Team LiB   Previous Section   Next Section