|
我需要对每一封abc@abc.com向我发送的邮件直接在原邮件基础上答复“同意放行”
根据网上的一些资源写了下面的代码,然后设置规则
但无法起作用,不知道是什么原因
请大神帮我看看,或者帮我写个更简短的代码。
拜谢
- Sub AutoReply(Item As Outlook.MailItem)
- Dim myAutoReplyMailItem As Outlook.MailItem
- Dim myReplyHTMLBody As String
- myReplyHTMLBody = CreateHTMLBody(1)
- If (Item.UnRead) And (Item.SenderEmailAddress = "abc@abc.com") Then
- Item.UnRead = False
- Set myAutoReplyMailItem = Item.Reply
- myAutoReplyMailItem.BodyFormat = olFormatHTML
- myAutoReplyMailItem.HTMLBody = myReplyHTMLBody & myAutoReplyMailItem.HTMLBody
- myAutoReplyMailItem.Send
- Item.Save
- End If
- Set Item = Nothing
- Set myAutoReplyMailItem = Nothing
- End Sub
- Public Function CreateHTMLBody(ID As Integer) As String
- 'Creates a new e-mail item and modifies its properties
- Dim objHTMLBody As String
- If ID = 1 Then
- objHTMLBody = _
- "<font face = 微软雅黑 size = 3>" & "同意放行"
- End If
- CreateHTMLBody = objHTMLBody
- End Function
复制代码
|
|