我使用谷歌帐户,说myaccount@google.com工作,我使用别名来处理我正在进行的各种项目。因此,对于project1,我使用myaccount+projet1@google.com,对于project2 myaccount+projet2@google.com等。我不需要在Mail中添加额外的帐户,因为GMail忽略了“+”符号之后的内容。 现在,在我的邮件帐户的配置中,我将所有地址(包括带有别名的地址)放在“电子邮件地址”字段中,以逗号分隔。因此,我可以通过我的任何电子邮件myaccount+project*@google.com发送消息。
我的问题是关于“回复”标题,我必须手动选择才能在正确的文件夹中接收邮件。我查看了设置,找不到解决方案。你知道任何方法自动完成(设置reply-to header与from相同)?也许是Apple脚本? 我知道我可以使用“默认写入”命令,但只允许为所有电子邮件指定一个特定的“回复”标题,这不是我正在寻找的。 p>
提前谢谢。
答案 0 :(得分:1)
这是我的WIP,我现在发布它,因为我从未完成它。希望我能用一个读取必填字段的示例来更新它,而不是硬编码。
(第3次,可能是最后更新)
道歉,如果这不能完全满足您的需求,但它确实完全符合我的需要,我相信您的要求比我的要简单。
-- Reply to current message with additional header changes.
-- (To be triggered from Keyboard Maestro, or ControllerMate on Alt-R)
-- function to read/focus/change data in message field
-- usage: set fieldValue to message_field("reply_to", false)
-- message_field("reply to", "moron")
on message_field(fieldname, newValue)
local tElements, tElement, tField, tValue, tClass
tell application "System Events"
tell process "Mail"
set frontmost to true
set tElements to scroll areas of window 1
repeat with tElement in tElements
set tName to get name of tElement as string
try
set tField to text field 1 of tElement
ignoring white space and punctuation
if (name of tField as string = fieldname) then
try
set tValue to get value of tField as string
on error
set tValue to ""
end try
set focused of tField to true
if (newValue ≠ false) then
set value of tField to newValue -- as string
end if
exit repeat
end if
end ignoring
end try
end repeat
end tell
end tell
return tValue
end message_field
-- split function (julifos @ macscripter.net)
to split(someText, delimiter)
set AppleScript's text item delimiters to delimiter
set someText to someText's text items
set AppleScript's text item delimiters to {""} --> restore delimiters to default value
return someText
end split
-- Get information from current/selected message
tell application "Mail"
set theSignatureName to "Signature #1"
set theMessages to the selected messages of the front message viewer
set theMessage to first item of theMessages
-- Get the email address (ours, hopefully) the message was sent to
set theMessageWasTo to address of first to recipient of theMessage as string
-- Unfortunately, it seesm that Mail doesn't honour the existing Reply-To header
-- when a reply is triggered from a script, instead of from the Reply menu.
-- So here is a bit of a dance to get it.
set theMessageHeaders to headers of theMessage
try
set theMessageReplyToWas to first item of {reply to} of theMessage -- (thx to Brian Christmas)
tell me to set theMessageReplyToWas to item 1 of split(theMessageReplyToWas, ",")
on error
set theMessageReplyToWas to sender of theMessage
end try
-- you can also use: set temp to {deleted status, all headers, was replied to, flag index, date received, message id, background color, subject, read status, flagged status, message size, date sent, junk mail status, source, sender, was forwarded, was redirected, content} of foo
-- set Theheaders to all headers of theMessage -- If you want to get all the headers in text form and process manually
-- set mySource to source of theMessage -- If you want the message source
set theOutgoingMessage to reply theMessage with opening window
-- I want to set "Reply-To" to be the address the message was sent to
tell me to message_field("reply to", theMessageWasTo)
tell theOutgoingMessage
-- I don't like this, as it adds an extra recipient
make new to recipient with properties {address:theMessageWasTo}
-- so I'll do it my way
tell me to message_field("to", theMessageWasTo)
end tell
-- It's easier if you just want to change the sender or signature or something
-- set message signature of theOutgoingMessage to signature theSignatureName
-- set sender of theOutgoingMessage to "Federico Viticci "
end tell
-- Now all that remains is to set the focus back to the body of the message.