0

添付ファイルを含む自動返信をMacメールで設定しようとしています。自動返信をテキストメッセージで機能させることはできますが、添付ファイルで機能させることはできません。私は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を使用したことがないので、明らかに何かが欠けています。どんな助けでもいただければ幸いです。MacOS10.8でMailv6.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 に答える