Hello,
I have created an application that issues a SQL statement, writes the
resulting rows into an Excel spreadsheet and then emails that spreadsheet as
an attachment to our customers. I want this to run daily and completely
unattended.
This works fine in XP where I developed it, but when I move the code to our
Win2K server, it chokes with the following message.
Could not access 'CDO Message' object.
This was built with .NET 1.1 with all service paks installed. It is in VB
and the actual snippet of code that fails is as follows:
Dim msg as new System.Web.mail.MailMessage
Dim atch as new System.Web.mail.MailAttachment("myExcel.wks")
Try
msg.<add all the required message stuff such as: to, from, bcc, subject,
and body>
msg.Attachments.Add(atch)
SmtpMail.SmtpServer = "my.mailserver.mail.com"
SmtpMail.Send(msg)
MessageBox.Show("It works!")
Catch ex as Exception
MessageBox.Show(ex.Message)
EndTry
I do not get the message box that it works, I only get the above mentioned
message.
I read some posts on Google and from that I gathered that sometimes the
cdosys.dll needs to be re-registered, so I found it in my System32 dir and
did a regsvr32 on it, That indicated success, but it did not solve my
problem.
This works just fine on my XP Pro development box using exactly the same
mail server.
Help!!!
Tim Reynolds
ti*@codeonellc.com