General discussion

Locked

email vb script

By R e p h l e x ·
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.

This conversation is currently closed to new comments.

7 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

by R e p h l e x In reply to email vb script

sorry, typo: SP2

Collapse -

by saihib In reply to email vb script
Collapse -

by R e p h l e x In reply to email vb script

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

Collapse -

Not recieving no error - But no test email

by RManning2010 In reply to

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

Collapse -

by lowlands In reply to email vb script

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

Collapse -

by R e p h l e x In reply to email vb script

Lowlands, your the man, that was so much help. Many thanks. A*+

Collapse -

by R e p h l e x In reply to email vb script

This question was closed by the author

Back to Windows Forum
7 total posts (Page 1 of 1)  

Related Discussions

Related Forums