Welcome! Log In


[VBS] Send a simple text mail
copy/paste in a mail.txt file lines below, then rename as mail.vbs and script this: cscript.exe mail.vbs

Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = SQL BACKUP PROBLEM"
objMessage.From = "sender@domain.com"
objMessage.To = "receiver@domain.com"
objMessage.TextBody = "SQL BACKUP PROBLEM"
objMessage.Send


with a file attachement:

Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "SQL FULL BACKUP PROBLEM"
objMessage.From = "sender@domain.com"
objMessage.To = "receiver@domain.com"
objMessage.Bcc= "copymail@domain.com"
objMessage.TextBody = "I6TM25 - SQL FULL BACKUP PROBLEM"
objMessage.AddAttachment "D:\_SAUVEGARDES-SQL\SQL2008ExpressR2\backupfailed.txt"
objMessage.Send


An other script:


Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "iMacros Message"
objMessage.From = "imacros@test.com"
objMessage.To = "jim@test.com"
objMessage.TextBody = "iMacros script completed. Status = OK"

'==This section provides the configuration information for the remote SMTP server.
'==Normally you will only change the server name or IP.
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing";) = 2
'Name or IP of Remote SMTP Server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver";) = "smtp.myserver.com"
'Server port (typically 25)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport";) = 25
objMessage.Configuration.Fields.Update
'==End remote SMTP server configuration section==

objMessage.Send



Edited 2 time(s). Last edit at 02/28/2017 05:34PM by iznogoud.
Sorry, only registered users may post in this forum.

Click here to login