Today I just discovered a free program supplied by Google in order to automatically setup Outlook express to send and receive email using your GMail account.
It just prompts you for ID and password and than creates the account within Outlook express. Nice.

I thought it would be good to create a little AppleScript and do the same with in OSX but I am already stuck at the very beginning.

Does anybody know if a new pop account can be created in using an AppleScript?

I have been browsing the libraries but could not find the necessary commands.

Thanks for your help


Hi King

Have a look at the default mail scripts you get under osx theres a script in there called “Create New Mail Account.scpt”
If i was a betting man i’d have to say that would be a very good place to start.

Good Luck!

Thank you very much for the hint, pidge1

As often happens, we simply have to search a little further than just our nose length… :smiley:


Hi guys, I am almost there but still need some help.

I have setup the Applescript using the, by Apple supplied, examples and basically it works.

There are however, still two unsolved issues:

  1. I try passing the password as a property of the new account within all others but it keeps staying blank.
    I need to manually insert the password first time. Is this related to keychain access?

  2. I am not able to set up the smtp server as I need.
    I am supplying all settings the same way as I do for the pop server but only the port number is kept. Authentication and password are not stored. What am I doing wrong here?

tell application "Mail"
	make new pop account with properties {name:theAccountName, user name:theUsername & "", server name:"", password:thePassword, full name:theFullName, email addresses:{theUsername & ""}, port:995, uses ssl:1}
	make new smtp server with properties {server name:"", port:587, uses ssl:1, user name:theUsername & "", password:thePassword}
end tell

Finally, trying to chose the right smtp server for that (given) account using the following:

tell application "Mail"
	set smtp server of theAccountName to ""
end tell

prompts me for an error message warning me that the script can’t do what I want.

Any clues anybody? :slight_smile:



UPDATE: Browsing the Mail scripting library I found the answer for the password retention.