我需要为Mail.app编写一个Applescript,它会将邮件主题导出到Excel工作表中。
我在网上找到的可以执行此操作的壁橱代码如下:
re.findall()
这些代码适用于邮箱垃圾。
但我不知道如何操作代码来选择Mail.app中Imap帐户的子文件夹中的邮件。
我在Mail.app中有几个Imap帐户。两个gmail帐户,一个iCloud帐户等。我还在每个Imap帐户下创建了折叠和子文件夹。
我想从子文件夹中导出未读邮件:它位于“Google / Supplier / SupplierUpdate”
我试图从
更改选择线 tell application "Microsoft Excel"
set theSpamFile to make new workbook
set theSheet to active sheet of theSpamFile
set formula of range "B1" of theSheet to "Subject"
set formula of range "A1" of theSheet to "From"
end tell
tell application "Mail"
set theRow to 2
get mailboxes
set theMessages to messages of junk mailbox
repeat with aMessage in theMessages
my SetFrom(sender of aMessage, theRow, theSheet)
my SetSubject(subject of aMessage, theRow, theSheet)
set theRow to theRow + 1
end repeat
end tell
on SetFrom(theSender, theRow, theSheet)
tell application "Microsoft Excel"
set theRange to "A" & theRow
set formula of (range theRange) of theSheet to theSender
end tell
end SetFrom
on SetSubject(theSubject, theRow, theSheet)
tell application "Microsoft Excel"
set theRange to "B" & theRow
set formula of range theRange of theSheet to theSubject
end tell
end SetSubject
到
set theMessages to messages of junk mailbox
但脚本编辑器会继续显示以下消息:
set theMessages to messages of mailbox"[Google]/DobaSupplierUpdate/DobaCancellation"
有任何帮助指出我正确的方向吗?
答案 0 :(得分:0)
尝试这样的事情:
-- set your email address here to find your account
set targetAccount to first item of (every account whose user name is "xxx@googlemail.com")
-- define the wanted subfolders here starting with deepest level
set theMessages to every message of mailbox "SupplierUpdate" of mailbox "Supplier" of targetAccount whose read status is false
最佳, ShooTerKo /汉堡