文字粘贴到邮件然后立即消失

时间:2014-02-28 07:24:15

标签: email applescript

当我从网页表单发送一堆电子邮件时,如果某行包含评论,我希望这些电子邮件粘贴到转发电子邮件的顶部。脚本似乎粘贴然后立即删除。我不是只发送Mail.app

中的电子邮件
tell application "Mail"
try
    set notes to {""}
    set email_selection to (get selection)
    repeat with a_msg in email_selection
        set theText to content of a_msg
        set their_name to words 2 thru -1 of paragraph 9 of theText
        set comments to paragraph -5 of theText
        set subscriber to paragraph 5 of theText
        if comments ≠ "comments: " then
            # set comments_LF to (comments as rich text) & return
            set the clipboard to comments as rich text
            copy {subscriber, comments as rich text} to the end of notes
            set the_forwarded_message to forward a_msg with opening window
            tell the_forwarded_message
                make new to recipient at end of to recipients with properties {name:"A Bloke Downunder", address:"abd@somewhere.com.au"}
                set subject to (their_name as rich text) & " has a comment on subscription form"
                activate
                tell application "System Events" to keystroke "v" using {command down}
                delay 1
            end tell

        end if
    end repeat
on error the error_message number the error_number
    tell application "AppleScript Editor"
        display dialog "Error: " & the error_number & ". " & the error_message buttons {"OK"} default button 1
    end tell
end try
end tell

电子邮件示例:

Below is the result of your feedback form.  It was submitted by (firstname.lastname@staff.uni.edu.au) on Thursday, February 6, 2014 at 15:46:19
---------------------------------------------------------------------------

email: firstname.lastname@staff.uni.edu.au

subject: Enquiry from Website

Name: Dr First I Lastname

Position: Professor

Organisation: University of Somewhere Law School

Phone: 

Mobile: 0432 000 111

Newsletter: Subscribe to List

Course_1: Subscribe

Course_7: Subscribe

Course_2: Subscribe

Course_9: Subscribe

Course_3: Subscribe

Course_10: Subscribe

Course_5: Subscribe

Course_11: Subscribe

Course_6: Subscribe

Course_15: Subscribe

Course_12: Subscribe

Course_16: Subscribe

Course_13: Subscribe

Course_4: Subscribe

Course_8: Subscribe

Course_14: Subscribe

comments: Please let me know when I can sit the first Course_4 course that you conduct in the new year.

Also I have a job I'd like you to consult on. Please be in touch.

根据在网络表单上勾选的复选框,在电子邮件中列出了多少个课程以订阅通知。有时字段将为空白。唯一必填字段是电子邮件地址。

0 个答案:

没有答案