code for mailing using CDO written in JavaScript

N

Neil Jarman

Hi,

I usually use VBScript to send emails, however I need to use JavaScript.

Can anyone supply the necessary code - I have tried this literal translation
and although it doesn't cause any errors, no mail arrives.

var sch = "http://schemas.microsoft.com/cdo/configuration/";

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

cdoConfig.Fields.Item(sch & "sendusing") = 2;
cdoConfig.Fields.Item(sch & "smtpserver") = "smtp.xyz.co.uk";
cdoConfig.Fields.Update();

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

cdoMessage.Configuration = cdoConfig;
cdoMessage.From = "[email protected]";
cdoMessage.To = "(e-mail address removed)";
cdoMessage.Subject = sSubject;
cdoMessage.TextBody = sBody;
cdoMessage.Send();

Any help appreciated.

Regards,

NEIL
 
N

Neil Jarman

Ahh - you're quite right!

After many many years coding in VB, I quite forget (or miss) JS little
differences sometimes!!

Many thanks.

NEIL
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

0x8004020F error with CDO.message 1
cdosys with windows 2003 error 3
just error 8004020f 1
Once Again 6
CDO.MESSAGE 1
asp send mail cdo error 1
CDO authentication problem 2
CDO Message help 1

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,072
Latest member
trafficcone

Latest Threads

Top