1
A
回答
0
这里的代码来做到这一点,在脚本桥接(可可):
for (MailRecipient *recp in message.recipients) {
MailToRecipient *theRecipient = [[[mail classForScriptingClass:@"to recipient"] alloc] initWithProperties:[NSDictionary dictionaryWithObjectsAndKeys:recp.address, @"address", nil]];
}
-1
草稿邮箱包含在邮件查看器中。由于邮件尚未发送,因此无法将其发送给“收件人”。但是,您可以获取包含收件人列表的邮件源。诀窍是从该文本中提取收件人。
tell application "Mail"
set the_messages to every message in drafts mailbox
repeat with this_message in the_messages
set message_content to the source of this_message
log message_content
end repeat
end tell
0
其实这是有可能不像早期提出的解决方案可可纯AppleScript的。以下是用于获取“收件人”收件人字段输入值的代码片段。
tell application "Mail"
set draftMessages to every message in drafts mailbox
set draftMessagesID to {}
# go through each draft message
repeat with draftMessage in draftMessages
set draftMessageID to id of draftMessage as string
copy draftMessageID to the end of draftMessagesID
end repeat
# go through the list of draft message ids and process the most recent item
if (count of the draftMessagesID) is greater than 1 then
set sortedDraftMessagesID to the reverse of my sortAlphabetically(the draftMessagesID)
# get only the first item, as this is the most recent
set lastDraftMessageID to first item of sortedDraftMessagesID as integer
# get the most recent draft message
set draftMessage to first message of drafts mailbox whose id is lastDraftMessageID
set toAddresees to {}
repeat with toRecipient in (get to recipients of draftMessage)
set toName to name of toRecipient
set toAddress to address of toRecipient
set toFinal to my composeNameAndAddress(toName, toAddress)
copy toFinal to end of toAddresees
end repeat
# now you have the input values of the TO field
log toAddresees
end if
end tell
#handler to compose name and address when one is missing
on composeNameAndAddress(name, address)
if name is missing value then
return address
else
return name & space & "<" & address & ">"
end if
end composeNameAndAddress
#handler to sort a list alphabetically
on sortAlphabetically(theList)
set the indexList to {}
set the sortedList to {}
repeat (the number of items in theList) times
set the lowItem to ""
repeat with i from 1 to (number of items in theList)
if i is not in the indexList then
set thisItem to item i of theList as string
if the lowItem is "" then
set the lowItem to thisItem
set the lowItemIndex to i
else if thisItem comes before the lowItem then
set the lowItem to thisItem
set the lowItemIndex to i
end if
end if
end repeat
set the end of sortedList to the lowItem
set the end of the indexList to the lowItemIndex
end repeat
return the sortedList
end sortAlphabetically
你提到,你需要一个具体的草案,对于这个剧本,我认为你可以(例如)采取草稿消息具有最高ID获取最新的草案。这就是上面的脚本使用带有通用简单排序处理程序的反向命令的功能。
相关问题
- 1. 无法从草稿(Mail.app)发送附件
- 2. Applescript在Mail.app中存档电子邮件
- 3. PHP:获取收件人ID
- 4. 无法在Yahoo草稿邮件中使用Webdriver获取草稿主题字段的值
- 5. DocuSign API Explorer - 使用文档和收件人创建草稿信封
- 6. Tkinter,草稿板
- 7. 在Mail.app/Three20中重新创建收件人气泡行为
- 8. 从草稿中的用户获取输入的文本
- 9. 获取信封的当前收件人
- 10. 如何获取草稿中的帖子标签?
- 11. SSRS草稿字体
- 12. Python:如何通过IMAP将密件抄送收件人的草稿电子邮件存储到Exchange Server?
- 13. Jekyll:草稿如何引用另一个草稿
- 14. 一次插入多个草稿组件
- 15. 幻想草稿工具
- 16. 为草稿添加标签
- 17. 草稿-js:自动换行
- 18. Delphi - Indy - 保存GMail草稿
- 19. VSTO展望从草稿
- 20. 保存在收件箱而不是草稿箱中的新Outlook MailItem
- 21. 如何在Mail.app中获取有关电子邮件的信息
- 22. Applescript获取元素
- 23. 在发送邮件时获取Thunderbird扩展的发件人和收件人
- 24. 获取NSAppleEventDescriptor的AppleScript属性
- 25. Powershell脚本获取Exchange 2010中的所有收件人和发件人地址
- 26. 使用打字稿的草坪椅
- 27. 跳棋的规则(草稿)死锁
- 28. 获得“null”作为草稿短信的地址
- 29. 计算草稿文件夹中的电子邮件数量 - Outlook
- 30. 获取每次对话的收件人的编号
其实,这是可能的。 – MegaEduX