昨天搞到晚上8点多,不容易啊,贴一下,查资料太难了,对于C#程序员是个绝大的考验啊,点不出来的感觉。。。。
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim recips As Outlook.Recipients
Dim strCs As String
Dim intCount As Integer
Dim flag As Integer
Dim i As Integer
Dim j As Integer
strUsers = Array("asan@163.com", "li4@163.com")'必须包含的邮箱数据
Set recips = Item.Recipients'所有收件人
intCount = Item.Attachments.Count'附件数量
If intCount <> 0 Then'附件数量大于0则进行校验
For i = 0 To UBound(strUsers)'没有Count属性,没有Length属性,只能用UBound函数获取数组上标
flag = 0
For j = 1 To recips.Count'下标居然从1开始的。。。
strCc = recips.Item(j).Address
If recips.Item(j).Type = olCC Then'只有抄送者才检测
If strCc = strUsers(i) Then
flag = 1
Exit For