CDO.Message Error

J

Jacques Cooper

Hello,

We're developing a small SMTP client application. When
we run the program we get the following error message:

"could not access 'CDO.Message' object"

We get the error message when we set the
"SmtpMail.SmtpServer" value. However, if
we don't specify the server name we don't
receive the email message either.

// C# source code snippet.
//

MailMessage mm = new MailMessage();

mm.From = "(e-mail address removed)";
mm.To = "(e-mail address removed)";
mm.Cc = "";
mm.Bcc = "";
mm.Subject = "Test Subject";
mm.Body = "Test Body";

SmtpMail.SmtpServer = "mycompany.com";

SmtpMail.Send(mm);

// end of code snippet

Any ideas about what could be causing the error message?

TIA,
Jacques
 
J

Jeffrey Tan[MSFT]

Hi Jacques,

Does your application run in asp.net?
The asp.net account may not have the enough privilege to access the network
an create sockets.
It DOES, however, have privileges to create a socket to the local machine
(127.0.0.1 localhost).
If you plan on using SmtpMail from an ASP.NET app, you MUST use your local
SMTP Service, and not an external one.
Alternatively, you could increase the privileges of the ASPNET account

or does your application multithread?
If it is multithreading, your mail code should run in the main form thread.

Hope this helps,

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| From: "Jacques Cooper" <[email protected]>
| Subject: CDO.Message Error
| Date: Mon, 3 Nov 2003 21:34:38 -0800
| Lines: 36
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.languages.csharp
| NNTP-Posting-Host: omega.jcsoftware.net 66.15.15.165
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP11.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:196511
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| Hello,
|
| We're developing a small SMTP client application. When
| we run the program we get the following error message:
|
| "could not access 'CDO.Message' object"
|
| We get the error message when we set the
| "SmtpMail.SmtpServer" value. However, if
| we don't specify the server name we don't
| receive the email message either.
|
| // C# source code snippet.
| //
|
| MailMessage mm = new MailMessage();
|
| mm.From = "(e-mail address removed)";
| mm.To = "(e-mail address removed)";
| mm.Cc = "";
| mm.Bcc = "";
| mm.Subject = "Test Subject";
| mm.Body = "Test Body";
|
| SmtpMail.SmtpServer = "mycompany.com";
|
| SmtpMail.Send(mm);
|
| // end of code snippet
|
| Any ideas about what could be causing the error message?
|
| TIA,
| Jacques
|
|
|
 
J

Jacques Cooper

Hello Jeffrey,

Thank you for responding to my posting. However, we are not using ASP.NET.
This is a stand-alone C# application.

Any ideas?

Thanks,
Jacques
 
G

Gary van der Merwe

Try putting a try catch round your code, Then print Exception.ToString()
With the SMTP exceptions, the message allways says "could not access
'CDO.Message' object", but if you do a Exception.ToString(), it gives you
more detail


Gary
 

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

Top