我正在尝试接收有关邮件应用程序中附件的信息。到目前为止,我能够从所选的电子邮件中接收数据。但我还想收到有关附件的信息。
tell application "Mail"
set selectedMessages to selection
set theMessage to item 1 of selectedMessages
set theMailbox to mailbox of theMessage
set mailAddresses to email addresses of account of theMailbox
return theAttachment in theMessage's mail attachments
end tell
如果我使用return mailAdresses
,脚本就可以工作但我无法获得有关附件的信息。任何提示?
答案 0 :(得分:1)
试试这个,返回值包含数据
theMessage
theMailbox
mailAddresses
所有选定消息的每条消息
tell application "Mail"
set selectedMessages to selection
set mailBoxData to {}
repeat with aMessage in selectedMessages
set theMailbox to mailbox of aMessage
set mailAddresses to email addresses of account of theMailbox
set attachmentData to {}
repeat with anAttachment in (get mail attachments of aMessage)
tell anAttachment to set end of attachmentData to {name, MIME type}
end repeat
set end of mailBoxData to {theMessage, theMailbox, mailAddresses, attachmentData}
end repeat
return mailBoxData
end tell