Home > other >  Automatically send E-mail after VBS meet the requirements
Automatically send E-mail after VBS meet the requirements

Time:09-15

Server batch automatic backup log data generated every day, I wrote a VBS code automatically send emails with attachments, if I want him to backup fails then the generated log will show copy on the day of the date such as 20200608, "zero copy files", I want to take advantage of this log let him if backup copy failed, automatically send email notification I run the VBS, below is the email written script, a great god, please help how to realize automatic backup failure email will not send success,




The NameSpace="http://schemas.microsoft.com/cdo/configuration/"
Set Email=CreateObject (" cdos. The Message ")
Email. The From="sender"
Email. To="recipient"
Email. The Subject="LOG"
X="C: 1. TXT"
Y="C: \ aaa. The log"
The Set of fso=CreateObject (" Scripting. FileSystemObject ")
The Set myfile=fso. OpenTextFile (x, 1, true)
C=myfile. Readall
Myfile. Close
Email. Textbody=c
Email. AddAttachment y
With Email. Configuration. Fields
The Item (NameSpace&" Sendusing ")=2
The Item (NameSpace&" Smtpserver ")="server address
"The Item (NameSpace&" Smtpserverport ")=25
The Item (NameSpace&" Smtpauthenticate ")=1
The Item (NameSpace&" Sendusername ")="user name"
The Item (NameSpace&" Sendpassword ")="password", "
. The Update
End with
Email. Send
The Set of Email=Nothing
  • Related