2
我是新手腳本,並且正在嘗試爲郵件寫一個簡單的腳本。我將用它在一個ical事件中發送我的草稿文件夾中的所有電子郵件。但是我遇到了一個錯誤,我不知道如何調試。這裏是我的腳本發送所有草稿在蘋果的郵件
tell application "Mail"
set draftMessages to every message in drafts mailbox
repeat with theMessage in draftMessages
set theSender to (sender of theMessage)
set theSubject to (subject of theMessage)
set theContent to (content of theMessage)
set theRecipients to (to recipients of theMessage)
set theAddress to (address of theRecipients)
set theMessage to make new outgoing message with properties {subject:theSubject, content:theContent, sender:theSender, address:theAddress, visible:true}
end repeat
end tell
這裏是與敏感信息的事件日誌替換爲等等。
tell application "Mail"
get every message of drafts mailbox
--> {message id 23241 of mailbox "Drafts" of account "BLAH", message id 23236 of mailbox "Drafts" of account "BLAH"}
get sender of message id 23241 of mailbox "Drafts" of account "BLAH"
--> "Blah Blah <[email protected]>"
get subject of message id 23241 of mailbox "Drafts" of account "BLAH"
--> "test 2"
get content of message id 23241 of mailbox "Drafts" of account "BLAH"
--> "test 2"
get every to recipient of message id 23241 of mailbox "Drafts" of account "BLAH"
--> {to recipient 1 of message id 23241 of mailbox "Drafts" of account "BLAH"}
Result:
error "Can’t get address of {to recipient 1 of message id 23241 of mailbox \"Drafts\" of
account \"BLAH\" of application \"Mail\"}." number -1728 from «class radd» of {«class
trcp» 1 of «class mssg» id 23241 of «class mbxp» "Drafts" of «class mact» "BLAH"}
我認爲那樣會工作,但當我這樣做的時候它會一直運行。 :(謝謝,但 – SavgStorm