-1

仕事用に myaccount@google.com などの Google アカウントを使用し、取り組んでいるさまざまなプロジェクトにエイリアスを使用しています。したがって、project1 には myaccount+projet1@google.com を使用し、project2 には myaccount+projet2@google.com などを使用します。GMail は "+" 記号の後にあるものを無視するため、メールにアカウントを追加する必要はありません。ここで、メール アカウントの構成で、すべてのアドレス (エイリアスを含むものも含む) を [電子メール アドレス] フィールドにコンマで区切って入力します。したがって、myaccount+project*@google.com のどのメールからでもメッセージを送信できます。

私の質問は、適切なフォルダーでメールを受信するために手動で選択する必要がある「返信先」ヘッダーについてです。設定を調べましたが、解決策が見つかりませんでした。自動的に行う方法を知っていますか (返信先ヘッダーを送信者と同じに設定します)? おそらくアップルスクリプト?「デフォルトの書き込み」コマンドを使用できることはわかっていますが、すべてのメールに対して特定の「返信先」ヘッダーを 1 つしか指定できないため、これは探しているものではありません。

前もって感謝します。

4

1 に答える 1

1

これが私のWIPです。完成しない場合に備えて、今投稿しています。ハードコーディングするのではなく、必要なフィールドを読み取る例でこれを更新できることを願っています。

(3回目、おそらく最後の更新)

これがあなたが必要としているものと正確に一致しない場合は申し訳ありませんが、私が必要としていたことは正確に行われました.

-- Reply to current message with additional header changes.
-- (To be triggered from Keyboard Maestro, or ControllerMate on Alt-R)

-- function to read/focus/change data in message field
-- usage: set fieldValue to message_field("reply_to", false) 
--        message_field("reply to", "moron")
on message_field(fieldname, newValue)
    local tElements, tElement, tField, tValue, tClass
    tell application "System Events"
        tell process "Mail"
            set frontmost to true
            set tElements to scroll areas of window 1
            repeat with tElement in tElements
                set tName to get name of tElement as string
                try
                    set tField to text field 1 of tElement
                    ignoring white space and punctuation

                        if (name of tField as string = fieldname) then
                            try
                                set tValue to get value of tField as string
                            on error
                                set tValue to ""
                            end try

                            set focused of tField to true

                            if (newValue ≠ false) then
                                set value of tField to newValue -- as string

                            end if
                            exit repeat
                        end if
                    end ignoring
                end try
            end repeat
        end tell
    end tell
    return tValue
end message_field

-- split function (julifos @ macscripter.net)
to split(someText, delimiter)
    set AppleScript's text item delimiters to delimiter
    set someText to someText's text items
    set AppleScript's text item delimiters to {""} --> restore delimiters to default value
    return someText
end split

-- Get information from current/selected message
tell application "Mail"
    set theSignatureName to "Signature #1"
    set theMessages to the selected messages of the front message viewer
    set theMessage to first item of theMessages

    -- Get the email address (ours, hopefully) the message was sent to
    set theMessageWasTo to address of first to recipient of theMessage as string


    -- Unfortunately, it seesm that Mail doesn't honour the existing Reply-To header
    -- when a reply is triggered from a script, instead of from the Reply menu.
    -- So here is a bit of a dance to get it.
    set theMessageHeaders to headers of theMessage
    try
        set theMessageReplyToWas to first item of {reply to} of theMessage -- (thx to Brian Christmas)
        tell me to set theMessageReplyToWas to item 1 of split(theMessageReplyToWas, ",")
    on error
        set theMessageReplyToWas to sender of theMessage
    end try

    -- you can also use: set temp to {deleted status, all headers, was replied to, flag index, date received, message id, background color, subject, read status, flagged status, message size, date sent, junk mail status, source, sender, was forwarded, was redirected, content} of foo 



    -- set Theheaders to all headers of theMessage -- If you want to get all the headers in text form and process manually
    -- set mySource to source of theMessage -- If you want the message source

    set theOutgoingMessage to reply theMessage with opening window

    -- I want to set "Reply-To" to be the address the message was sent to
    tell me to message_field("reply to", theMessageWasTo)

    tell theOutgoingMessage
        -- I don't like this, as it adds an extra recipient
        make new to recipient with properties {address:theMessageWasTo}
        -- so I'll do it my way
        tell me to message_field("to", theMessageWasTo)
    end tell

    -- It's easier if you just want to change the sender or signature or something
    -- set message signature of theOutgoingMessage to signature theSignatureName
    -- set sender of theOutgoingMessage to "Federico Viticci "

end tell

-- Now all that remains is to set the focus back to the body of the message.
于 2013-11-15T11:11:36.130 に答える