Exception using SmtpMail.Send method

O

olrt

Hello, I checked the SmtpMail.SmtpServer
I checked the recipients address of the message
I checked the sender address

But still have the following exception when SmtpMail.Send :-( ::

-----------------------------------
Failed to send message : System.Web.HttpException: Unable to create
object 'CDO.Message'.
at System.Web.Mail.LateBoundAccessHelper.get_LateBoundType()
at System.Web.Mail.LateBoundAccessHelper.CreateInstance()
at System.Web.Mail.CdoSysHelper.Send(MailMessage message)
at System.Web.Mail.SmtpMail.Send(MailMessage message)
at Services.ServiceMail.SvcMail.envoyerMessageEmailSmtp(MailMessage
msg) in
-----------------------------------


I checked that my smtp server works and manually sent a message with
telnet on port 25 of
the server (it's Microsoft SMTP Server).

Can someone help ??
 
K

Kevin Spencer

Are you sure that CDO is installed on that machine? CDO is a COM object that
is used by SmtpMail to send emails. If you have .Net 2.0 you can use the
System.Net.Mail Namespace classes instead, which do not rely on any COM
objects.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

Big thicks are made up of lots of little thins.
 
O

olrt

Kevin said:
Are you sure that CDO is installed on that machine? CDO is a COM object that
is used by SmtpMail to send emails. If you have .Net 2.0 you can use the
System.Net.Mail Namespace classes instead, which do not rely on any COM
objects.
First, thanks a lot for your precious answer.
I work with .NET Framework 1.1
How can I check that CDO is installed ?
 
K

Kevin Spencer

The easiest way would be using Visual Studio, with a Solution open, go to
the References item in the Solution view, right-click and select "Add
Reference..."

The COM tab shows all the COM objects registered on your machine. I believe
CDO will be called "Microsoft CDO..." (something or other).

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

Big thicks are made up of lots of little thins.
 
O

olrt

Kevin Spencer a écrit :
The easiest way would be using Visual Studio, with a Solution open, go to
the References item in the Solution view, right-click and select "Add
Reference..."

The COM tab shows all the COM objects registered on your machine. I believe
CDO will be called "Microsoft CDO..." (something or other).


Hello.
I have progressed a little.
I did a regsvr32 cdosys.dll and now I have the following Exception
message :

-----------------------------------------------------------
System.Web.HttpException: Unable to access 'CDO.Message'. --->
System.Reflection.TargetInvocationException: ...... --->
System.Runtime.InteropServices.COMException (0x80040154): Class not
registered


What dll are used by CDO ?
 
O

olrt

I got finally it working.
I commented out SmtpMail.SmtpServer="localhost";

It's weird that when one specify "localhost" in SmtpServer ,
SmtpMail.Send throws an exception !!!
I don't understand why.



So for those who want to have class SmtpMail work :
1°) regsvr32 cdosys.dll
2°) Install a local SMTP Server on the machine and comment
SmtpMail.SmtpServer

Hope it helps !!
 
K

Kevin Spencer

I have progressed a little.
I did a regsvr32 cdosys.dll and now I have the following Exception
message :

You're skipping some important details:

1. Did you *find* a COM object named "cdosys.dll?"
2. Did the registration return a positive or negative response?

Assuming that the DLL is registered, I don't know of any external
dependencies of that DLL. You might try checking out the "Troubleshooting"
webcast from Microsoft:
http://support.microsoft.com/servic...rvicedesks/webcasts/en/wcd012203/manifest.xml

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

Big thicks are made up of lots of little thins.



Kevin Spencer a écrit :
The easiest way would be using Visual Studio, with a Solution open, go to
the References item in the Solution view, right-click and select "Add
Reference..."

The COM tab shows all the COM objects registered on your machine. I
believe
CDO will be called "Microsoft CDO..." (something or other).


Hello.
I have progressed a little.
I did a regsvr32 cdosys.dll and now I have the following Exception
message :

-----------------------------------------------------------
System.Web.HttpException: Unable to access 'CDO.Message'. --->
System.Reflection.TargetInvocationException: ...... --->
System.Runtime.InteropServices.COMException (0x80040154): Class not
registered


What dll are used by CDO ?
 
K

Kevin Spencer

Glad you got it working. The "localhost" error is probably a host name
resolution issue. I'm not sure how CDOSYS resolves host names, but putting
in the actual machine name or the IP address will work as well. It defaults
to the local machine in any case.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

Big thicks are made up of lots of little thins.


I got finally it working.
I commented out SmtpMail.SmtpServer="localhost";

It's weird that when one specify "localhost" in SmtpServer ,
SmtpMail.Send throws an exception !!!
I don't understand why.



So for those who want to have class SmtpMail work :
1°) regsvr32 cdosys.dll
2°) Install a local SMTP Server on the machine and comment
SmtpMail.SmtpServer

Hope it helps !!
 

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