我正在尝试在Mac Mail中设置包含附件的自动回复。我可以使用自动回复来处理短信,但不能使用附件。我正在尝试使用applescript,但我并不熟悉它。我试过了
tell application "Mail"
set {theSender, theAddress, theSubject} to {extract name from sender, extract address from sender, subject}
set theBody to "Hi - attached you will find out paper, Effects of experimental forest management on a terrestrial, woodland salamander in Missouri, which you requested. If you believe you received this email without solicitation please let me know at dhocking@unh.edu.I hope you find our paper useful! -Dan"
set theAttachment to "Macintosh HD:Users:Dan:Documents:Papers2:Hocking:2013:Articles:Hocking_2013_Forest_Ecology_and_Management.pdf" as alias
set MyReply to make new outgoing message with properties {recipient:theSender, subject:"Hello: " & theSubject, content:theBody}
make new attachment at MyReply with properties {file:_Attachment}
--open MyReply --comment out if you dont need
send MyReply --un comment this to auto send your mail
end tell
我也试过
using terms from application "Mail"
on perform mail action with messages theMessages for rule theRule
repeat with eachMessage in theMessages
tell application "Mail"
set theAttachment to "Macintosh HD:Users:Dan:Documents:Papers2:Hocking:2013:Articles:Hocking_2013_Forest_Ecology_and_Management.pdf"
tell eachMessage
set {theSender, theAddress, theSubject} to {extract name from sender, extract address from sender, subject}
end tell
set newMessage to make new outgoing message with properties {subject:"Re: " & theSubject, visible:true}
tell newMessage
make new to recipient at end of to recipients with properties {name:theSender, address:theAddress}
tell content to make new attachment with properties {file name:theAttachment as alias} at after the last paragraph
end tell
activate
send newMessage
end tell
end repeat
end perform mail action with messages
end using terms from
我确定我错过了一些简单的东西,但我之前从未使用过AppleScript,所以很明显我错过了一些东西。任何帮助,将不胜感激。我在Mac OS 10.8上使用Mail v6.2。
答案 0 :(得分:0)
在将其设置为规则后尝试此操作:
using terms from application "Mail"
on perform mail action with messages theMessages for rule theRule
try
set theAttachment to "Macintosh HD:Users:Dan:Documents:Papers2:Hocking:2013:Articles:Hocking_2013_Forest_Ecology_and_Management.pdf"
repeat with eachMessage in theMessages
tell application "Mail"
tell eachMessage
set {theSender, theAddress, theSubject} to {extract name from sender, extract address from sender, subject}
end tell
set newMessage to make new outgoing message with properties {subject:"Re: " & theSubject, visible:true}
tell newMessage
make new to recipient at end of to recipients with properties {name:theSender, address:theAddress}
tell content to make new attachment with properties {file name:theAttachment as alias} at after the last paragraph
end tell
activate
send newMessage
end tell
end repeat
on error m number n
display dialog "Error: " & m
tell application "Mail"
log "Exception in Mail action: (" & n & ") " & m
end tell
end try
end perform mail action with messages
end using terms from