我有一个注册域名,我使用hushmail作为邮件提供商。我想从Mail.app发送电子邮件,就好像它们是从我的域发送的一样。出于安全原因(垃圾邮件),Hushmail SMTP服务器不允许我使用与我的帐户名不同的“来自”地址。
我找到了一种让Apple邮件一直填写邮件回复邮件的方法,在这里:http://email.about.com/od/macosxmailtips/qt/etalwaysreplyto.htm但这对我来说太激烈了,因为我的邮件客户端有多个邮件帐户。 / p>
在Mail.app中,我可以手动设置“回复”字段,但Mail.app中没有设置根据我选择的邮箱自动填充。
到目前为止,我有一个AppleScript能够在所选邮件上创建回复:
tell application "Mail"
set theSelection to selection
if theSelection is {} then return
activate
repeat with thisMessage in theSelection
set theOutgoingMessage to reply thisMessage with opening window
# Wait for Mail.app to create the reply window
repeat until exists (window 1 whose name = "Re: " & subject of thisMessage)
end repeat
delay 0.1
#
# Here I want to set the reply-to address here based on the
# selected mailbox, or the "from" address of
# the current mail.
#
#
# The I need to restore the cursor to the body of the mail
# (if cursor was moved)
#
end repeat
end tell
我查看了AppleScript词典(文件 - >打开词典 - > Mail.app - >消息 - >消息 - >回复),这似乎是我应该能够的属性设置,但当我做的事情:
tell theOutgoingMessage
make new recipient at end of reply to with properties {address:"myreplyto@example.com"}
弹出错误消息“邮件收到错误:无法收到外发邮件ID 65的回复。”
我也试过
tell theOutgoingMessage
set reply to to "myreplyto@example.com"
但是会弹出一个错误,说“邮件收到错误:无法将外发邮件ID 69的回复设置为”myreplyto@example.com“。
如何设置刚刚创建的回复邮件的回复属性?
答案 0 :(得分:2)
正如我在您的帖子的评论中提到的,您无法以编程方式设置回复地址,因为它是只读属性。因此,您需要使用ui编写此解决方案脚本。
ui脚本的问题在于它不是一门精确的科学。如果Apple更改了ui元素的位置,那么您的脚本将停止工作。例如,我有Mail.app v6.5,并且可以使用“窗口1的滚动区域1的文本字段1”来引用回复字段。在其他版本的Mail.app中可能有所不同(可能是)。
无论如何,在Mail.app的v6.5中,这将使用ui脚本执行您想要的操作。
tell application "Mail"
set theSelection to selection
if theSelection is {} then return
activate
repeat with thisMessage in theSelection
set replyToAddress to item 1 of (get email addresses of account of mailbox of thisMessage)
set replyToWindowName to subject of thisMessage
if replyToWindowName does not start with "Re:" then set replyToWindowName to "Re: " & replyToWindowName
-- open the reply message
set theOutgoingMessage to reply thisMessage with opening window
-- Wait for Mail.app to create the reply window
repeat until exists (window 1 whose name is replyToWindowName)
delay 0.2
end repeat
-- make sure the reply-to field is showing
my openReplyToField()
-- set the reply-to address here based on the selected mailbox
my setValueOfReplyToField(replyToAddress)
end repeat
end tell
on openReplyToField()
tell application "System Events"
tell process "Mail"
-- figure out if the reply-to text field is visible
set staticText to value of every static text of window 1
if staticText contains "Reply To:" then return
-- the reply-to field is not visible so we click the menu item
set viewMenu to menu 1 of menu bar item "View" of menu bar 1
set replyToMenuItem to first menu item of viewMenu whose name contains "Reply-To"
click replyToMenuItem
end tell
end tell
end openReplyToField
on setValueOfReplyToField(theValue)
tell application "System Events"
tell process "Mail"
set replyToField to text field 1 of scroll area 1 of window 1
set value of replyToField to theValue
end tell
end tell
end setValueOfReplyToField
答案 1 :(得分:0)
尝试这是否有效:
make new recipient at end of to recipients with properties {address:"myreplyto@example.com"}