我需要将一个巨大的会话从osx邮件导出到csv文件。我的AppleScript应该适用于选定的邮件。这就是我所拥有的:
tell application "Mail"
set selectedMessages to selection
if (count of selectedMessages) is equal to 0 then
display alert "Please select some message first"
end if
set mailInformation to ""
repeat with tMsg in selectedMessages
set mailInformation to mailInformation & "'" & {date received of tMsg} & "';'" & {sender of tMsg} & "';'" & {address of first recipient of tMsg} & "';'" & {subject of tMsg} & "'" & (ASCII character 10) as string
end repeat
end tell
tell application "TextEdit"
set theDocument to make new document
set text of theDocument to mailInformation
end tell
问题:如何获取当前邮件的收件人?它似乎是一个列表。
这不起作用:
{address of first recipient of tMsg}
谢谢!
答案 0 :(得分:0)
address of first recipient of tMsg
应该有效。
但是你为什么先创建一个列表然后再将它弄平?这也是一样的:
set mailInformation to mailInformation & "'" & date received of tMsg & "';'" & sender of tMsg & "';'" & address of first recipient of tMsg & "';'" & subject of tMsg & "'" & linefeed