Sending mail using CDO JavaScript error - Server is undefined
- by Rotem
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