【发布时间】:2016-06-03 09:02:31
【问题描述】:
我希望创建一个规则,根据收件人/抄送收件人的域名有条件地添加密件抄送收件人。我已经将this 问题确定为类似问题,但似乎尚未解决。
起始代码如下:
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim objRecip As Recipient
Dim strMsg As String
Dim res As Integer
Dim strBcc As String
On Error Resume Next
' #### USER OPTIONS ####
' address for Bcc -- must be SMTP address or resolvable
' to a name in the address book
strBcc = "SomeEmailAddress@domain.com"
Set objRecip = Item.Recipients.Add(strBcc)
objRecip.Type = olBCC
If Not objRecip.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 objRecip = Nothing
End Sub
在伪代码中,我希望将以下条件添加到 strBCC 字符串:
If ToCCRecipientDomain = "@example1.co.uk"
Then strBCC = "email1@trello.com"
ElseIf ToCCRecipientDomain ="@example2.co.uk"
Then strBCC = "email2@trello.com"
ElseIf ToCCRecipientDomain ="@example3.co.uk"
Then strBCC = "email3@trello.com"
Else
Then Cancel = True
End If
对于那些对此应用程序/原因感兴趣的人,我希望在特定项目的 Trello 板上创建一个发送给客户的电子邮件列表,这将取决于发送到的电子邮件地址。
【问题讨论】: