我有以下代码,我可以通过我配置的 Outlook 发送邮件。我可以使用 Outlook 中的规则运行此 vbs,然后将邮件发送到脚本中指定的电子邮件
但是在运行此脚本以发送邮件时,我收到了一个确认框,询问是否有病毒。
如何摆脱此确认框以始终允许发送邮件。
Dim ToAddress
Dim MessageSubject
Dim MessageBody
Dim MessageAttachment
Dim ol, ns, newMail
ToAddress = "John.Smith@place.com" ' change this...
MessageSubject = "My Subject"
MessageBody = "DATA"
Set ol = WScript.CreateObject("Outlook.Application")
Set ns = ol.getNamespace("MAPI")
ns.logon "","",true,false
Set newMail = ol.CreateItem(olMailItem)
newMail.Subject = MessageSubject
newMail.Body = MessageBody & vbCrLf
' validate the recipient, just in case...
Set myRecipient = ns.CreateRecipient(ToAddress)
myRecipient.Resolve
If Not myRecipient.Resolved Then
MsgBox "unknown recipient"
Else
newMail.Recipients.Add(myRecipient)
newMail.Send
End If
Set ol = Nothing