Sending mail using CDO JavaScript error - Server is undefined

Posted by Rotem on Stack Overflow See other posts from Stack Overflow or by Rotem
Published on 2010-12-25T15:53:44Z Indexed on 2010/12/25 17:54 UTC
Read the original article Hit count: 212

Filed under:
|
|
|
|

Hi,

I got this code to send email using SMTP server, I tried many configuration of it that I found online, also VBscript similar code, and non of it is working.

I want to focus on this code, when I'm opening the HTA I'm getting error in line 8, says 'Server is undefined', What should I do to define it?

var cdoConfig = Server.CreateObject("CDO.Configuration"); 
cdoConfig.Fields("cdoSMTPServerName") = "194.90.9.22"; 

var cdoMessage = Server.CreateObject("CDO.Message"); 
cdoMessage.Configuration = cdoConfig; 

var cdoBodyPart = cdoMessage.BodyPart; 

cdoMessage.To = "[email protected]"; 
cdoMessage.From = "[email protected]"; 
cdoMessage.Subject = "CDO Test in JScript"; 
cdoMessage.TextBody = "This is a test email sent using JScript."; 
cdoMessage.send(); 

Thanks, Rotem

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about html