使用 Applescript 获取有关电子邮件附件的信息
Getting Information about e-mail Attachments with Applescript
我正在尝试在邮件应用程序中接收有关附件的信息。到目前为止,我能够从所选的电子邮件中接收数据。但我还想收到有关附件的信息。
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
脚本可以工作,但我无法获取有关附件的信息。有什么提示吗?
试试这个,return 值包含数据
theMessage
theMailbox
mailAddresses
- 所有附件的名称和 mime 类型列表
所有选定消息中的每条消息
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
我正在尝试在邮件应用程序中接收有关附件的信息。到目前为止,我能够从所选的电子邮件中接收数据。但我还想收到有关附件的信息。
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
脚本可以工作,但我无法获取有关附件的信息。有什么提示吗?
试试这个,return 值包含数据
theMessage
theMailbox
mailAddresses
- 所有附件的名称和 mime 类型列表
所有选定消息中的每条消息
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