Automate Apple Mail setup in 10.8

boberito
Valued Contributor

I'm looking for a way to automate the setup of Apple Mail in 10.8. We use Google Apps for mail. I have an applescript that works great, if there's already an account created in Apple Mail. If there is no account already created the applescript fails due to the Mail Assistant popping up.

Is there a way to setup Apple Mail using configuration profiles? Or scripting without the assistant popping up?

My dream is that this script runs at the initial login to setup Apple Mail for the user.

3 REPLIES 3

boberito
Valued Contributor

So after scratching my head all day. I was able to get 99% of the setup done with a Managed Preference. The only thing I can't set is the IMAP port to 993 it would appear.

I've also tried Configuration Profiles but you have to set it to the user level which Casper appears to not push out. You must install manually. However, I can't figure out how to set the variables like username and full name in there. I saw that you can use $USERNAME and $FULLNAME from the Casper Administration Guide and I saw from an Apple Document using %Full_Name% and %short_name% I believe, but I'm not having success with either.

Any help would be appreciated.

icemobile
New Contributor II

User level only works with AD or OD accounts. I think sinds Casper Suite populates the settings you'd have to use $USERNAME and the sorts.

woggledog
New Contributor

A while ago, this post, but could you use a smidge of AppleScript to detect that the Mail Assistant has opened?

Ensure that you have "Enable Access for Assistive Devices" set in System Prefs

Your AppleScript will be:

tell application "System Events" try tell process "Mail" -- these are untidily in try statements as not every element is always visible try set instruc to name of every static text of group 1 of group 1 of window 1 as text end try end tell end try
end tell

and this will return, if the assistant window is visible:

"Welcome to MailYou’ll be guided through the steps to set up your mail account.

To get started, provide the following information:Full Name:Password:Email Address:"

Easy enough to detect

Regards,

Paul
PS: Do people talk about AppleScript on here without fear?