wedz
02-15-2005, 07:07 AM
Hi fellow developers,
I have run into a problem when changing the platform from older Windows (2000) to windows server 2003. There is an asp page that sends mail using javascript and it used to work ok when using normal CDONTS components. After doing some extensive trial and error and researching from web I have come to a conclusion that I need to use CDOSYS here as CDONTS is deprecated. However I am unable to send the mails anymore.
From other similar threads I have understood that I need to have CDONTS components registered, but I am unfamiliar with ASP and IIS so I am not sure how to do this exactly. Can you please point out to my problem, or if the code is correct guide me how to properly set needed permission etc.
thank you for the effort, here is the javascript code that should send the mails:
var error;
try {
var myMail = Server.CreateObject("cdo.message");
var mailConfig = Server.CreateObject("cdo.configuration");
mailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2;
mailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "<here is mailserver address>";
mailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25;
try {
mailConfig.Fields.Update;
} catch (error) {
Response.Write("error updating config<br>");
}
myMail.Configuration = mailConfig;
myMail.From = FromWho;
myMail.To = toWho;
myMail.Cc = CCopy;
myMail.Subject = Subject;
myMail.TextBody = Body;
myMail.Send();
This has been solved now, I was missing "()" from the end of
mailConfig.Fields.Update() ;
Man this was driving me nuts...
I have run into a problem when changing the platform from older Windows (2000) to windows server 2003. There is an asp page that sends mail using javascript and it used to work ok when using normal CDONTS components. After doing some extensive trial and error and researching from web I have come to a conclusion that I need to use CDOSYS here as CDONTS is deprecated. However I am unable to send the mails anymore.
From other similar threads I have understood that I need to have CDONTS components registered, but I am unfamiliar with ASP and IIS so I am not sure how to do this exactly. Can you please point out to my problem, or if the code is correct guide me how to properly set needed permission etc.
thank you for the effort, here is the javascript code that should send the mails:
var error;
try {
var myMail = Server.CreateObject("cdo.message");
var mailConfig = Server.CreateObject("cdo.configuration");
mailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2;
mailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "<here is mailserver address>";
mailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25;
try {
mailConfig.Fields.Update;
} catch (error) {
Response.Write("error updating config<br>");
}
myMail.Configuration = mailConfig;
myMail.From = FromWho;
myMail.To = toWho;
myMail.Cc = CCopy;
myMail.Subject = Subject;
myMail.TextBody = Body;
myMail.Send();
This has been solved now, I was missing "()" from the end of
mailConfig.Fields.Update() ;
Man this was driving me nuts...