473,382 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Cannot access 'CDO' object.

I know that this has been asked before; and not only that, I know that it has been answered (successfully) as I myself have previously resolved the problem (with help) - however, I cannot for the life of me remember what the solution was.

I am trying to send an email from an ASP.net application. If I send the email with the MailMessage.BodyFormat = MailFormat.Text then it sends fine; if I set MailMessage.BodyFormat = MailFormat.Html then I get the following exception:
COMException (0x80040605): Unknown Error]

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters) +0
System.RuntimeType.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParameters) +473
System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args) +29
System.Web.Mail.LateBoundAccessHelper.SetProp(Type type, Object obj, String propName, Object propValue)
System.Web.Mail.LateBoundAccessHelper.SetProp(Obje ct obj, String propName, Object propValue)

[HttpException (0x80004005): Could not access 'CDO.Message' object.]
System.Web.Mail.LateBoundAccessHelper.SetProp(Obje ct obj, String propName, Object propValue)
System.Web.Mail.CdoSysHelper.Send(MailMessage message)
System.Web.Mail.SmtpMail.Send(MailMessage message)
My code is simple:
// Prepare the message to be sent ...
MailMessage mailMessage = new MailMessage();
mailMessage.To = "martin.robins@..."; // Changed to avoid spam
mailMessage.From = "emails@..."; // Changed to avoid spam
mailMessage.Subject = "My email";
mailMessage.BodyFormat = MailFormat.Html;
mailMessage.Body = "<html><body>Welcome<P>New line text<BR>Another line</P></body></html>";
SmtpMail.SmtpServer = "MyServer";
SmtpMail.Send(mailMessage);
I am using Framework 1.1 on Windows/XP Pro - I also have Office 2003 installed (I seem to recall that this is relevant)

All help gratefully accepted. I have already tried the usual candidates (MS Knowledgebase, systemwebmail.com etc.) and I cannot find the answer on there. I have also tried catching the exception and looking for inner exceptions; I cannot identify any further information from them than is shown above!

Thanks.
Jan 30 '06 #1
6 1243
Most likley scenario is that your machine ( server ) is not enabled to allow mail relay. You need to correct this. See your exchange settings or look in your policy documents on your local machine if this is where you are running it from.
"Martin Robins" <martin dot robins at technicaldirect dot co dot uk> wrote in message news:uo**************@TK2MSFTNGP15.phx.gbl...
I know that this has been asked before; and not only that, I know that it has been answered (successfully) as I myself have previously resolved the problem (with help) - however, I cannot for the life of me remember what the solution was.

I am trying to send an email from an ASP.net application. If I send the email with the MailMessage.BodyFormat = MailFormat.Text then it sends fine; if I set MailMessage.BodyFormat = MailFormat.Html then I get the following exception:
COMException (0x80040605): Unknown Error]

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters) +0
System.RuntimeType.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParameters) +473
System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args) +29
System.Web.Mail.LateBoundAccessHelper.SetProp(Type type, Object obj, String propName, Object propValue)
System.Web.Mail.LateBoundAccessHelper.SetProp(Obje ct obj, String propName, Object propValue)

[HttpException (0x80004005): Could not access 'CDO.Message' object.]
System.Web.Mail.LateBoundAccessHelper.SetProp(Obje ct obj, String propName, Object propValue)
System.Web.Mail.CdoSysHelper.Send(MailMessage message)
System.Web.Mail.SmtpMail.Send(MailMessage message)
My code is simple:
// Prepare the message to be sent ...
MailMessage mailMessage = new MailMessage();
mailMessage.To = "martin.robins@..."; // Changed to avoid spam
mailMessage.From = "emails@..."; // Changed to avoid spam
mailMessage.Subject = "My email";
mailMessage.BodyFormat = MailFormat.Html;
mailMessage.Body = "<html><body>Welcome<P>New line text<BR>Another line</P></body></html>";
SmtpMail.SmtpServer = "MyServer";
SmtpMail.Send(mailMessage);
I am using Framework 1.1 on Windows/XP Pro - I also have Office 2003 installed (I seem to recall that this is relevant)

All help gratefully accepted. I have already tried the usual candidates (MS Knowledgebase, systemwebmail.com etc.) and I cannot find the answer on there. I have also tried catching the exception and looking for inner exceptions; I cannot identify any further information from them than is shown above!

Thanks.
Jan 30 '06 #2
Unfortunately this cannot be the case; if I send the message as text instead of HTML everything works. This rules out the SMTP server as it is relaying the non-HTML messages ok.
"Newbie" <me@me.com> wrote in message news:Os*************@TK2MSFTNGP14.phx.gbl...
Most likley scenario is that your machine ( server ) is not enabled to allow mail relay. You need to correct this. See your exchange settings or look in your policy documents on your local machine if this is where you are running it from.
"Martin Robins" <martin dot robins at technicaldirect dot co dot uk> wrote in message news:uo**************@TK2MSFTNGP15.phx.gbl...
I know that this has been asked before; and not only that, I know that it has been answered (successfully) as I myself have previously resolved the problem (with help) - however, I cannot for the life of me remember what the solution was.

I am trying to send an email from an ASP.net application. If I send the email with the MailMessage.BodyFormat = MailFormat.Text then it sends fine; if I set MailMessage.BodyFormat = MailFormat.Html then I get the following exception:
COMException (0x80040605): Unknown Error]

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters) +0
System.RuntimeType.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParameters) +473
System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args) +29
System.Web.Mail.LateBoundAccessHelper.SetProp(Type type, Object obj, String propName, Object propValue)
System.Web.Mail.LateBoundAccessHelper.SetProp(Obje ct obj, String propName, Object propValue)

[HttpException (0x80004005): Could not access 'CDO.Message' object.]
System.Web.Mail.LateBoundAccessHelper.SetProp(Obje ct obj, String propName, Object propValue)
System.Web.Mail.CdoSysHelper.Send(MailMessage message)
System.Web.Mail.SmtpMail.Send(MailMessage message)
My code is simple:
// Prepare the message to be sent ...
MailMessage mailMessage = new MailMessage();
mailMessage.To = "martin.robins@..."; // Changed to avoid spam
mailMessage.From = "emails@..."; // Changed to avoid spam
mailMessage.Subject = "My email";
mailMessage.BodyFormat = MailFormat.Html;
mailMessage.Body = "<html><body>Welcome<P>New line text<BR>Another line</P></body></html>";
SmtpMail.SmtpServer = "MyServer";
SmtpMail.Send(mailMessage);
I am using Framework 1.1 on Windows/XP Pro - I also have Office 2003 installed (I seem to recall that this is relevant)

All help gratefully accepted. I have already tried the usual candidates (MS Knowledgebase, systemwebmail.com etc.) and I cannot find the answer on there. I have also tried catching the exception and looking for inner exceptions; I cannot identify any further information from them than is shown above!

Thanks.
Jan 30 '06 #3
You might want to take a look at:

www.systemwebmail.com

Sonu Kapoor [MVP]
---
Posted via www.DotNetSlackers.com
Jan 31 '06 #4
Martins you should be able to get some more info here at:-
http://www.systemwebmail.com/
Hope that helps
Patrick

"Martin Robins" <martin at orpheus-solutions dot co dot uk> wrote in message news:eY**************@TK2MSFTNGP09.phx.gbl...
Unfortunately this cannot be the case; if I send the message as text instead of HTML everything works. This rules out the SMTP server as it is relaying the non-HTML messages ok.
"Newbie" <me@me.com> wrote in message news:Os*************@TK2MSFTNGP14.phx.gbl...
Most likley scenario is that your machine ( server ) is not enabled to allow mail relay. You need to correct this. See your exchange settings or look in your policy documents on your local machine if this is where you are running it from.
"Martin Robins" <martin dot robins at technicaldirect dot co dot uk> wrote in message news:uo**************@TK2MSFTNGP15.phx.gbl...
I know that this has been asked before; and not only that, I know that it has been answered (successfully) as I myself have previously resolved the problem (with help) - however, I cannot for the life of me remember what the solution was.

I am trying to send an email from an ASP.net application. If I send the email with the MailMessage.BodyFormat = MailFormat.Text then it sends fine; if I set MailMessage.BodyFormat = MailFormat.Html then I get the following exception:
COMException (0x80040605): Unknown Error]

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters) +0
System.RuntimeType.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParameters) +473
System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args) +29
System.Web.Mail.LateBoundAccessHelper.SetProp(Type type, Object obj, String propName, Object propValue)
System.Web.Mail.LateBoundAccessHelper.SetProp(Obje ct obj, String propName, Object propValue)

[HttpException (0x80004005): Could not access 'CDO.Message' object.]
System.Web.Mail.LateBoundAccessHelper.SetProp(Obje ct obj, String propName, Object propValue)
System.Web.Mail.CdoSysHelper.Send(MailMessage message)
System.Web.Mail.SmtpMail.Send(MailMessage message)
My code is simple:
// Prepare the message to be sent ...
MailMessage mailMessage = new MailMessage();
mailMessage.To = "martin.robins@..."; // Changed to avoid spam
mailMessage.From = "emails@..."; // Changed to avoid spam
mailMessage.Subject = "My email";
mailMessage.BodyFormat = MailFormat.Html;
mailMessage.Body = "<html><body>Welcome<P>New line text<BR>Another line</P></body></html>";
SmtpMail.SmtpServer = "MyServer";
SmtpMail.Send(mailMessage);
I am using Framework 1.1 on Windows/XP Pro - I also have Office 2003 installed (I seem to recall that this is relevant)

All help gratefully accepted. I have already tried the usual candidates (MS Knowledgebase, systemwebmail.com etc.) and I cannot find the answer on there. I have also tried catching the exception and looking for inner exceptions; I cannot identify any further information from them than is shown above!

Thanks.
Jan 31 '06 #5
Thanks Patrick; but as I stated in my original message, I have already been through all of the options on that site. These fixes all seem to apply to errors with the SmtpServer configuration.

My problem is more specific; the error only occurs when I am sending a message as HTML - if I send text all is well.

Martin.

"Patrick.O.Ige" <na********@hotmail.com> wrote in message news:eb**************@TK2MSFTNGP14.phx.gbl...
Martins you should be able to get some more info here at:-
http://www.systemwebmail.com/
Hope that helps
Patrick

"Martin Robins" <martin at orpheus-solutions dot co dot uk> wrote in message news:eY**************@TK2MSFTNGP09.phx.gbl...
Unfortunately this cannot be the case; if I send the message as text instead of HTML everything works. This rules out the SMTP server as it is relaying the non-HTML messages ok.
"Newbie" <me@me.com> wrote in message news:Os*************@TK2MSFTNGP14.phx.gbl...
Most likley scenario is that your machine ( server ) is not enabled to allow mail relay. You need to correct this. See your exchange settings or look in your policy documents on your local machine if this is where you are running it from.
"Martin Robins" <martin dot robins at technicaldirect dot co dot uk> wrote in message news:uo**************@TK2MSFTNGP15.phx.gbl...
I know that this has been asked before; and not only that, I know that it has been answered (successfully) as I myself have previously resolved the problem (with help) - however, I cannot for the life of me remember what the solution was.

I am trying to send an email from an ASP.net application. If I send the email with the MailMessage.BodyFormat = MailFormat.Text then it sends fine; if I set MailMessage.BodyFormat = MailFormat.Html then I get the following exception:
COMException (0x80040605): Unknown Error]

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters) +0
System.RuntimeType.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParameters) +473
System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args) +29
System.Web.Mail.LateBoundAccessHelper.SetProp(Type type, Object obj, String propName, Object propValue)
System.Web.Mail.LateBoundAccessHelper.SetProp(Obje ct obj, String propName, Object propValue)

[HttpException (0x80004005): Could not access 'CDO.Message' object.]
System.Web.Mail.LateBoundAccessHelper.SetProp(Obje ct obj, String propName, Object propValue)
System.Web.Mail.CdoSysHelper.Send(MailMessage message)
System.Web.Mail.SmtpMail.Send(MailMessage message)
My code is simple:
// Prepare the message to be sent ...
MailMessage mailMessage = new MailMessage();
mailMessage.To = "martin.robins@..."; // Changed to avoid spam
mailMessage.From = "emails@..."; // Changed to avoid spam
mailMessage.Subject = "My email";
mailMessage.BodyFormat = MailFormat.Html;
mailMessage.Body = "<html><body>Welcome<P>New line text<BR>Another line</P></body></html>";
SmtpMail.SmtpServer = "MyServer";
SmtpMail.Send(mailMessage);
I am using Framework 1.1 on Windows/XP Pro - I also have Office 2003 installed (I seem to recall that this is relevant)

All help gratefully accepted. I have already tried the usual candidates (MS Knowledgebase, systemwebmail.com etc.) and I cannot find the answer on there. I have also tried catching the exception and looking for inner exceptions; I cannot identify any further information from them than is shown above!

Thanks.
Jan 31 '06 #6
Do you have an anti-virus programs running? If so, it may be configured to
block HTML messages.

Mike.

"Martin Robins" <martin dot robins at technicaldirect dot co dot uk> wrote
in message news:ua**************@tk2msftngp13.phx.gbl...
Thanks Patrick; but as I stated in my original message, I have already been
through all of the options on that site. These fixes all seem to apply to
errors with the SmtpServer configuration.

My problem is more specific; the error only occurs when I am sending a
message as HTML - if I send text all is well.

Martin.

"Patrick.O.Ige" <na********@hotmail.com> wrote in message
news:eb**************@TK2MSFTNGP14.phx.gbl...
Martins you should be able to get some more info here at:-
http://www.systemwebmail.com/
Hope that helps
Patrick

"Martin Robins" <martin at orpheus-solutions dot co dot uk> wrote in message
news:eY**************@TK2MSFTNGP09.phx.gbl...
Unfortunately this cannot be the case; if I send the message as text instead
of HTML everything works. This rules out the SMTP server as it is relaying
the non-HTML messages ok.
"Newbie" <me@me.com> wrote in message
news:Os*************@TK2MSFTNGP14.phx.gbl...
Most likley scenario is that your machine ( server ) is not enabled to allow
mail relay. You need to correct this. See your exchange settings or look in
your policy documents on your local machine if this is where you are running
it from.
"Martin Robins" <martin dot robins at technicaldirect dot co dot uk> wrote
in message news:uo**************@TK2MSFTNGP15.phx.gbl...
I know that this has been asked before; and not only that, I know that it
has been answered (successfully) as I myself have previously resolved the
problem (with help) - however, I cannot for the life of me remember what the
solution was.

I am trying to send an email from an ASP.net application. If I send the
email with the MailMessage.BodyFormat = MailFormat.Text then it sends fine;
if I set MailMessage.BodyFormat = MailFormat.Html then I get the following
exception:
COMException (0x80040605): Unknown Error]

[TargetInvocationException: Exception has been thrown by the target of an
invocation.]
System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr,
Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture,
String[] namedParameters) +0
System.RuntimeType.InvokeMember(String name, BindingFlags invokeAttr,
Binder binder, Object target, Object[] args, ParameterModifier[] modifiers,
CultureInfo culture, String[] namedParameters) +473
System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder
binder, Object target, Object[] args) +29
System.Web.Mail.LateBoundAccessHelper.SetProp(Type type, Object obj,
String propName, Object propValue)
System.Web.Mail.LateBoundAccessHelper.SetProp(Obje ct obj, String
propName, Object propValue)

[HttpException (0x80004005): Could not access 'CDO.Message' object.]
System.Web.Mail.LateBoundAccessHelper.SetProp(Obje ct obj, String
propName, Object propValue)
System.Web.Mail.CdoSysHelper.Send(MailMessage message)
System.Web.Mail.SmtpMail.Send(MailMessage message)
My code is simple:
// Prepare the message to be sent ...
MailMessage mailMessage = new MailMessage();
mailMessage.To = "martin.robins@..."; // Changed to avoid spam
mailMessage.From = "emails@..."; // Changed to avoid spam
mailMessage.Subject = "My email";
mailMessage.BodyFormat = MailFormat.Html;
mailMessage.Body = "<html><body>Welcome<P>New line text<BR>Another
line</P></body></html>";
SmtpMail.SmtpServer = "MyServer";
SmtpMail.Send(mailMessage);
I am using Framework 1.1 on Windows/XP Pro - I also have Office 2003
installed (I seem to recall that this is relevant)

All help gratefully accepted. I have already tried the usual candidates (MS
Knowledgebase, systemwebmail.com etc.) and I cannot find the answer on
there. I have also tried catching the exception and looking for inner
exceptions; I cannot identify any further information from them than is
shown above!

Thanks.

Feb 1 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Thys Brits | last post by:
Hi, I'm using the System.Web.Mail class to send an e-mail from my ASP.Net application, but when sending the e-mail, I'm getting the above error. It seems to be because I have Office XP...
1
by: Carol | last post by:
Hi, I am using VB.NET2003 on a Windows XP. I tried to write a simple program to send email with attachment (see below for the code). I add reference to "Microsoft CDO 1.21 library" and "Microsoft...
2
by: Desmond | last post by:
Hi, I would really appreciate if somebody could give some advise on this. I've a ASP.NET application that is supposed to send emails and it is tested to be working well on IIS 5.0 and tested...
0
by: Jacob Anderson | last post by:
Hello In my ASP.NET application and other windows services that access the CDO.Message object via the System.Web.Mail namespace, I often get the "Could not access the CDO.Message object" message. ...
2
by: MattB | last post by:
I've taken some working code from a vb clas library that was a part of a web application and put it into a stand alone class library so I can reuse it from other applications. I'm using some code...
1
by: gamorgan | last post by:
I am having trouble with mail attachments when executing mail.send(message). The mail attachment is fine if it is an RTF, but as soon as i use JPEG or Doc then i get the error of Cannot access...
5
by: Sean | last post by:
Hi... I want to use the macro/sendobject (or any other procedure) to send the contents of a table (very small, ~5 rows/columns) as an Outlook message body, not as an attachment. Access 2000 will...
5
by: Martin Robins | last post by:
I know that this has been asked before; and not only that, I know that it has been answered (successfully) as I myself have previously resolved the problem (with help) - however, I cannot for the...
12
by: Dave G | last post by:
Apologies if this has been covered before - I couldn't find it. I currently use ASPEmail to create and send HTML emails from an Access database. The text is personalised and includes embedded...
0
by: Dhananjay | last post by:
Hi All, I want to develop one application in vb.net for exchange 2000. I tried to add one contact with the code snippet below. The same logic is there for appointment on Microsoft's site. (I...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.