構成された 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