Quantcast
Channel: Active questions tagged email - Stack Overflow
Viewing all articles
Browse latest Browse all 29748

When I try to run this VB Script it says "object required" and I cannot find an error

$
0
0
Dim objMessage
Set objMessage = CreateObject("CDO.Message")

objMessage.Subject = "ALARMNO SPOROĆILO Z NADZORNEGA SISTEMA"
objMessage.From = "someemail@hotmail.com"
objMessage.To = "toemail@hotmail.com"
objMessage.HTMLBody = "Zdravo"

objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = 1

objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60

objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"

objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465

objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1

objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "someemail@gmail"

objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "00000000000000"


objMessage.Configuration.Fields.Update

REM Now send the message

On error Resume Next
Obj.Message.Send

IF err.Number <> 0 Then

MsgBox Err.Description,16,"Error sending Mail "
Else
MsgBox " Message sent "
END IF 

I wrote this code in Notepad++ and saved it as a .vbs file and try to run it, but I get "object required" error. I cannot find the problem.


Viewing all articles
Browse latest Browse all 29748

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>