Discussion Locked

email vb script

0 helpful
7 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hello all, can anyone help, why does the below script not work on my sp3 xp machine???

Set objEmail = CreateObject("CDO.Message")

objEmail.From = "g.millen1@ntlworld.com"
objEmail.To = "g.millen1@ntlworld.com"
objEmail.Subject = "Atl-dc-01 down"
objEmail.Textbody = "Atl-dc-01 is no longer accessible over the network."
objEmail.send

i'm getting the below error:

the "sendUsing" configuration value is invalid
code: 80040220
source: CDO.message.1

Anyone know why.

thanks in advance.

7 replies

by r e p h l e x

Changed my script to below, till no luck. getting the error object required objSMTPMail, code: 800A01A8

Any help.

Set objEmail = CreateObject("CDO.Message")
objSMPTMail.SmtpServer = "mail.ntlworld.com"
objEmail.From = "g.millen1@ntlworld.com"
objEmail.To = "g.millen1@ntlworld.com"
objEmail.Subject = "Atl-dc-01 down"
objEmail.Textbody = "Atl-dc-01 is no longer accessible over the network."
objEmail.send

by rmanning2010

Here is a copy of my script.

Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "Test Email"
objMessage.From = "wyonker@ccc.org"
objMessage.To = "manninr2@ccc.org"
objMessage.Textbody = "Did it work!!"

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

objMessage.Configuration.Fields.Item_
("http://schemas.microsoft.com/cdo/configuration/smtpserver?) = ?vmware01.com?

objMessage.Configuration.Fields.Item_
(?http://schemas.microsoft.com/cdo/configuration/smtpserverport?) = 25

objMessage.Configuration.Fields.Update

objMessage.Send

by lowlands

your code assumes you have a SMTP server running on your PC. My guess is that that is not the case. So you'll have to add some code to define a remote smtp server.
So you'll end up with something like this:

Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "Example Message"
objMessage.From = "test@test.com"
objMessage.To = "you@test.com"
objMessage.TextBody = "Test text."

'==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

This discussion is closed to new replies.