0

我正在尝试在包含附件的 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

我确定我遗漏了一些简单的东西,但我以前从未使用过苹果脚本,所以很明显我遗漏了一些东西。任何帮助,将不胜感激。我在 Mac OS 10.8 上使用 Mail v6.2。

4

1 回答 1

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
于 2013-01-25T09:48:23.337 回答