在Lion上使用applescript设置IMAP Mail.app帐户失败

时间:2011-10-28 11:08:19

标签: macos automation applescript

我有一个简单的shell脚本,用于在OS X上设置一个新的邮件帐户,它在Snow Leopard上运行得非常好。

#! /bin/sh
open /Applications/Mail.app
arch -i386 /usr/bin/osascript <<EOF
using terms from application "Mail"
  tell application "Mail"
    set email_address to (short user name of (system info)) & "@address.com"
    set full_name to (long user name of (system info))

    set new_imap to make imap account with properties {name:email_address, user name:email_address, password:"", uses ssl:true, server name:"server.com", port:"993", full name:full_name, email addresses:{email_address}}

    # do stuff
    quit
  end tell
end using terms from
EOF

但它对Lion不起作用。

execution error: Mail got an error: Can’t make class imap account. (-2710)

我尝试了很多不同的东西,比如将样本plist文件(设置了适当的值)复制到用户的〜/ Library / Preferences / com.apple.mail.plist等等,但它没有帮助。

该脚本仅在我手动创建新帐户,删除它,然后运行脚本时才有效。有没有其他人有类似的问题?或者可能还有另一种自动设置IMAP帐户的方法吗?

非常感谢!

0 个答案:

没有答案