0

本文に特定の「STRING」を含む電子メールを返信/転送し、BCC に電子メール アドレスを設定するたびに実行されるスクリプトを作成するにはどうすればよいですか?

ありがとうございました!

4

1 に答える 1

1

コードを ThisOutlookSession モジュールに配置し、

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim olRecip As Recipient
    Dim strMsg As String
    Dim res As Integer
    Dim olBcc As String
    On Error Resume Next

    '// set email address here
    olBcc = "Address@domain.com"

    Set olRecip = Item.Recipients.Add(olBcc)
    olRecip.Type = olBcc
    If Not olRecip.Resolve Then
        strMsg = "Could not resolve the Bcc recipient. " & _
                 "Do you want still to send the message?"
        res = MsgBox(strMsg, vbYesNo + vbDefaultButton1, _
                 "Could Not Resolve Bcc Recipient")
        If res = vbNo Then
            Cancel = True
        End If
    End If

    Set olRecip = Nothing
End Sub

特定のメッセージについては、IF ステートメントを使用してメッセージをフィルター処理する必要があります。またはカテゴリ フィールドで、一連の If ステートメントを使用する必要がある場合は、カテゴリによるフィルタリングが最も簡単な場合があります。

If Item.Categories = "blabla" Then
      olBcc = "address@domain.com"

     ElseIf Item.Categories = "Important" Then
      olBcc = "new@address.com"

     Else

      Exit Sub
    End If

    Set olRecip = Item.Recipients.Add(olBcc)

詳細はこちら

于 2015-05-20T00:14:00.843 に答える