Setting up a new Mail account

So check this out: I’m trying to make a new Applescript to automatically configure a new account. For the moment, I’m using gmail as a stand-in for the real server info.

tell application "Mail"
	make new imap account with properties {name:"Gmail IMAP", user name:"foo", server name:"imap.gmail.com", full name:"bar", smtp server:"smtp.gmail.com"}
end tell

Obviously this isn’t complete, but it doesn’t really matter if it is. Regardless of what properties I put in there or don’t, it generates the error “Mail got an error: AppleEvent handler failed.” This error seems to extend to any use of the ‘make’ command with regards to Mail.

Anything I can do to circumvent this? I’ve heard rumors on the internets that this might be a bug, but don’t know anything for sure.

I’m using MacOS X10.5.6.

Just a quick bump to see if anyone had a solution. Anyone?