Can't get .NET System.Web.Mail classes or cdonts.dll to work on NT4 even after installing NT4 Option Pack
Posted on 2004-08-25
I have a simple .NET executable using the System.Web.Mail.MailMessage and System.Web.Mail.SmtpMail classes.
My C# code works fine on my Windows 2000 machine, but the same code doesn't work on my NT4 machine.
At first, I was getting an error message about cdonts.dll. Then I installed the NT4 Option Pack. The errors went away, but the email never arrives at the destination when I run the program from the NT4 machine.
In the system event log, there is the following "red" event: "Server events initialization failed for virtual server 1. Server events may not be called for this virtual server. (Event ID 1002, Source SMTPSVC)." But it seems this message was produced by the NT4 Option Pack install because running my email executable does not make an event log entry.
Here's the code.
MailMessage MyMail = new MailMessage();
MyMail.From = strFrom;
MyMail.To = strTo;
MyMail.Subject = strSubject;
MyMail.Body = strBody;
SmtpMail.SmtpServer = strSmtpServer;
Thanks in advance.