我正在编写一个脚本来回复每封收到的电子邮件。
我制定了一条规则,对运行脚本、设置类别并标记为已读的所有传入消息运行。该规则设置类别并标记为已读,但不运行脚本。下面是我的代码:
Sub reply(Item As Outlook.MailItem)
MsgBox "Hey this script is running!"
On Error GoTo ErrorTrap
Dim MsgReply As Outlook.MailItem
Set MsgReply = Item.reply
With MsgReply
.Subject = "Welcome to IT Business Builder"
.HTMLBody = "This is just a test"
.Body = "This is just a test"
.Send
End With
Set MsgReply = Nothing
ErrorTrap:
MsgBox Err.Number & " " & Err.Description & " message not sent because of error"
End Sub
运行规则后,不弹出消息框,不发送电子邮件。