473,714 Members | 2,398 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

When MailMessage.Bod yFormat = MailFormat.Html , SmtpMail.Send throws exception

Why does SmtpMail.Send throw an exception if the MailMessage's
BodyFormat = MailFormat.Html ? I've searched all over the place and
cannot find a solution anywhere. I am running this on Windows XP SP2,
and IIS's SMTP and WWW servers are installed.

Here is the error trace:
System.Web.Http Exception: Could not access 'CDO.Message' object. --->
System.Reflecti on.TargetInvoca tionException: Exception has been thrown
by the target of an invocation. --->
System.Runtime. InteropServices .COMException (0x80040605): Unknown
Error
--- End of inner exception stack trace ---
at System.RuntimeT ype.InvokeDispM ethod(String name, BindingFlags
invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers,
Int32 culture, String[] namedParameters )
at System.RuntimeT ype.InvokeMembe r(String name, BindingFlags
invokeAttr, Binder binder, Object target, Object[] args,
ParameterModifi er[] modifiers, CultureInfo culture, String[]
namedParameters )
at System.Type.Inv okeMember(Strin g name, BindingFlags invokeAttr,
Binder binder, Object target, Object[] args)
at System.Web.Mail .LateBoundAcces sHelper.SetProp (Type type, Object
obj, String propName, Object propValue)
at System.Web.Mail .LateBoundAcces sHelper.SetProp (Object obj, String
propName, Object propValue)
--- End of inner exception stack trace ---
at System.Web.Mail .LateBoundAcces sHelper.SetProp (Object obj, String
propName, Object propValue)
at System.Web.Mail .CdoSysHelper.S end(MailMessage message)
at System.Web.Mail .SmtpMail.Send( MailMessage message)
at TestArea.suq.Bu tton1_Click(Obj ect sender, EventArgs e) in
c:\inetpub\wwwr oot\testarea\su q.aspx.cs:line 69
----------------------
InnerException:
System.Web.Http Exception: Could not access 'CDO.Message' object. --->
System.Reflecti on.TargetInvoca tionException: Exception has been thrown
by the target of an invocation. --->
System.Runtime. InteropServices .COMException (0x80040605): Unknown
Error
--- End of inner exception stack trace ---
at System.RuntimeT ype.InvokeDispM ethod(String name, BindingFlags
invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers,
Int32 culture, String[] namedParameters )
at System.RuntimeT ype.InvokeMembe r(String name, BindingFlags
invokeAttr, Binder binder, Object target, Object[] args,
ParameterModifi er[] modifiers, CultureInfo culture, String[]
namedParameters )
at System.Type.Inv okeMember(Strin g name, BindingFlags invokeAttr,
Binder binder, Object target, Object[] args)
at System.Web.Mail .LateBoundAcces sHelper.SetProp (Type type, Object
obj, String propName, Object propValue)
at System.Web.Mail .LateBoundAcces sHelper.SetProp (Object obj, String
propName, Object propValue)
--- End of inner exception stack trace ---
at System.Web.Mail .LateBoundAcces sHelper.SetProp (Object obj, String
propName, Object propValue)
at System.Web.Mail .CdoSysHelper.S end(MailMessage message)
at System.Web.Mail .SmtpMail.Send( MailMessage message)
at TestArea.suq.Bu tton1_Click(Obj ect sender, EventArgs e) in
c:\inetpub\wwwr oot\testarea\su q.aspx.cs:line 69
----------------------
InnerException:
System.Reflecti on.TargetInvoca tionException: Exception has been thrown
by the target of an invocation. --->
System.Runtime. InteropServices .COMException (0x80040605): Unknown
Error
--- End of inner exception stack trace ---
at System.RuntimeT ype.InvokeDispM ethod(String name, BindingFlags
invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers,
Int32 culture, String[] namedParameters )
at System.RuntimeT ype.InvokeMembe r(String name, BindingFlags
invokeAttr, Binder binder, Object target, Object[] args,
ParameterModifi er[] modifiers, CultureInfo culture, String[]
namedParameters )
at System.Type.Inv okeMember(Strin g name, BindingFlags invokeAttr,
Binder binder, Object target, Object[] args)
at System.Web.Mail .LateBoundAcces sHelper.SetProp (Type type, Object
obj, String propName, Object propValue)
at System.Web.Mail .LateBoundAcces sHelper.SetProp (Object obj, String
propName, Object propValue)

Here is my code:
MailMessage mailMessage = new MailMessage();

mailMessage.To = "ac*****@smu.ed u";
mailMessage.Sub ject = "This bug sucks ass.";
mailMessage.Bod yFormat = MailFormat.Html ;
mailMessage.Bod y = "aaaaa";
mailMessage.Fro m = "aa*****@smu.ed u";

SmtpMail.SmtpSe rver.Insert(0, "www.smu.ed u");
try
{
SmtpMail.Send(m ailMessage);
}
catch (Exception ex)
{
Response.Write( "<pre>");
Response.Write( ex.ToString());

while (ex.InnerExcept ion != null)
{
Response.Write( "\n----------------------\n");
Response.Write( "InnerException :\n" + ex.ToString());
ex = ex.InnerExcepti on;
}
Response.Write( "</pre");
}

Any clues?

Aren
Nov 18 '05 #1
4 7546
the error message is generic, any error in CDO causes it. does textmode
work? does html work if you send valid html?

-- bruce (sqlwork.com)
"Aren Cambre" <ac*****@mail.s mu.edu> wrote in message
news:da******** *************** ***@posting.goo gle.com...
Why does SmtpMail.Send throw an exception if the MailMessage's
BodyFormat = MailFormat.Html ? I've searched all over the place and
cannot find a solution anywhere. I am running this on Windows XP SP2,
and IIS's SMTP and WWW servers are installed.

Here is the error trace:
System.Web.Http Exception: Could not access 'CDO.Message' object. --->
System.Reflecti on.TargetInvoca tionException: Exception has been thrown
by the target of an invocation. --->
System.Runtime. InteropServices .COMException (0x80040605): Unknown
Error
--- End of inner exception stack trace ---
at System.RuntimeT ype.InvokeDispM ethod(String name, BindingFlags
invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers,
Int32 culture, String[] namedParameters )
at System.RuntimeT ype.InvokeMembe r(String name, BindingFlags
invokeAttr, Binder binder, Object target, Object[] args,
ParameterModifi er[] modifiers, CultureInfo culture, String[]
namedParameters )
at System.Type.Inv okeMember(Strin g name, BindingFlags invokeAttr,
Binder binder, Object target, Object[] args)
at System.Web.Mail .LateBoundAcces sHelper.SetProp (Type type, Object
obj, String propName, Object propValue)
at System.Web.Mail .LateBoundAcces sHelper.SetProp (Object obj, String
propName, Object propValue)
--- End of inner exception stack trace ---
at System.Web.Mail .LateBoundAcces sHelper.SetProp (Object obj, String
propName, Object propValue)
at System.Web.Mail .CdoSysHelper.S end(MailMessage message)
at System.Web.Mail .SmtpMail.Send( MailMessage message)
at TestArea.suq.Bu tton1_Click(Obj ect sender, EventArgs e) in
c:\inetpub\wwwr oot\testarea\su q.aspx.cs:line 69
----------------------
InnerException:
System.Web.Http Exception: Could not access 'CDO.Message' object. --->
System.Reflecti on.TargetInvoca tionException: Exception has been thrown
by the target of an invocation. --->
System.Runtime. InteropServices .COMException (0x80040605): Unknown
Error
--- End of inner exception stack trace ---
at System.RuntimeT ype.InvokeDispM ethod(String name, BindingFlags
invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers,
Int32 culture, String[] namedParameters )
at System.RuntimeT ype.InvokeMembe r(String name, BindingFlags
invokeAttr, Binder binder, Object target, Object[] args,
ParameterModifi er[] modifiers, CultureInfo culture, String[]
namedParameters )
at System.Type.Inv okeMember(Strin g name, BindingFlags invokeAttr,
Binder binder, Object target, Object[] args)
at System.Web.Mail .LateBoundAcces sHelper.SetProp (Type type, Object
obj, String propName, Object propValue)
at System.Web.Mail .LateBoundAcces sHelper.SetProp (Object obj, String
propName, Object propValue)
--- End of inner exception stack trace ---
at System.Web.Mail .LateBoundAcces sHelper.SetProp (Object obj, String
propName, Object propValue)
at System.Web.Mail .CdoSysHelper.S end(MailMessage message)
at System.Web.Mail .SmtpMail.Send( MailMessage message)
at TestArea.suq.Bu tton1_Click(Obj ect sender, EventArgs e) in
c:\inetpub\wwwr oot\testarea\su q.aspx.cs:line 69
----------------------
InnerException:
System.Reflecti on.TargetInvoca tionException: Exception has been thrown
by the target of an invocation. --->
System.Runtime. InteropServices .COMException (0x80040605): Unknown
Error
--- End of inner exception stack trace ---
at System.RuntimeT ype.InvokeDispM ethod(String name, BindingFlags
invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers,
Int32 culture, String[] namedParameters )
at System.RuntimeT ype.InvokeMembe r(String name, BindingFlags
invokeAttr, Binder binder, Object target, Object[] args,
ParameterModifi er[] modifiers, CultureInfo culture, String[]
namedParameters )
at System.Type.Inv okeMember(Strin g name, BindingFlags invokeAttr,
Binder binder, Object target, Object[] args)
at System.Web.Mail .LateBoundAcces sHelper.SetProp (Type type, Object
obj, String propName, Object propValue)
at System.Web.Mail .LateBoundAcces sHelper.SetProp (Object obj, String
propName, Object propValue)

Here is my code:
MailMessage mailMessage = new MailMessage();

mailMessage.To = "ac*****@smu.ed u";
mailMessage.Sub ject = "This bug sucks ass.";
mailMessage.Bod yFormat = MailFormat.Html ;
mailMessage.Bod y = "aaaaa";
mailMessage.Fro m = "aa*****@smu.ed u";

SmtpMail.SmtpSe rver.Insert(0, "www.smu.ed u");
try
{
SmtpMail.Send(m ailMessage);
}
catch (Exception ex)
{
Response.Write( "<pre>");
Response.Write( ex.ToString());

while (ex.InnerExcept ion != null)
{
Response.Write( "\n----------------------\n");
Response.Write( "InnerException :\n" + ex.ToString());
ex = ex.InnerExcepti on;
}
Response.Write( "</pre");
}

Any clues?

Aren

Nov 18 '05 #2
"bruce barker" <no***********@ safeco.com> wrote in message news:<u1******* *******@TK2MSFT NGP11.phx.gbl>. ..
the error message is generic, any error in CDO causes it. does textmode
work? does html work if you send valid html?


Text mode worked fine.

This is very, very strange: I rebooted my computer, and HTML mode
works fine now. Maybe I've run into an intermittent bug?

Aren
Nov 18 '05 #3
I have same problem too. When I set textmode it works fine, but I set
htmlmode it cause 'cdo.message' exception. My development enviroments
are Windows XP (not sp2) & Visual Studio 2002. Is there anyone to help
it?

ac*****@mail.sm u.edu (Aren Cambre) wrote in message news:<da******* *************** ****@posting.go ogle.com>...
"bruce barker" <no***********@ safeco.com> wrote in message news:<u1******* *******@TK2MSFT NGP11.phx.gbl>. ..
the error message is generic, any error in CDO causes it. does textmode
work? does html work if you send valid html?


Text mode worked fine.

This is very, very strange: I rebooted my computer, and HTML mode
works fine now. Maybe I've run into an intermittent bug?

Aren

Nov 18 '05 #4

Why does SmtpMail.Send throw an exception if the MailMessage's
BodyFormat = MailFormat.Html ? I've searched all over the place and
cannot find a solution anywhere. I am running this on Windows XP SP2,
and IIS's SMTP and WWW servers are installed.

Here is the error trace:
System.Web.Http Exception: Could not access 'CDO.Message' object. --->
System.Reflecti on.TargetInvoca tionException: Exception has been thrown
by the target of an invocation. --->
System.Runtime. InteropServices .COMException (0x80040605): Unknown
Error
--- End of inner exception stack trace ---
at System.RuntimeT ype.InvokeDispM ethod(String name, BindingFlags
invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers,
Int32 culture, String[] namedParameters )
at System.RuntimeT ype.InvokeMembe r(String name, BindingFlags
invokeAttr, Binder binder, Object target, Object[] args,
ParameterModifi er[] modifiers, CultureInfo culture, String[]
namedParameters )
at System.Type.Inv okeMember(Strin g name, BindingFlags invokeAttr,
Binder binder, Object target, Object[] args)
at System.Web.Mail .LateBoundAcces sHelper.SetProp (Type type, Object
obj, String propName, Object propValue)
at System.Web.Mail .LateBoundAcces sHelper.SetProp (Object obj, String
propName, Object propValue)
--- End of inner exception stack trace ---
at System.Web.Mail .LateBoundAcces sHelper.SetProp (Object obj, String
propName, Object propValue)
at System.Web.Mail .CdoSysHelper.S end(MailMessage message)
at System.Web.Mail .SmtpMail.Send( MailMessage message)
at TestArea.suq.Bu tton1_Click(Obj ect sender, EventArgs e) in
c:\inetpub\wwwr oot\testarea\su q.aspx.cs:line 69
----------------------
InnerException:
System.Web.Http Exception: Could not access 'CDO.Message' object. --->
System.Reflecti on.TargetInvoca tionException: Exception has been thrown
by the target of an invocation. --->
System.Runtime. InteropServices .COMException (0x80040605): Unknown
Error
--- End of inner exception stack trace ---
at System.RuntimeT ype.InvokeDispM ethod(String name, BindingFlags
invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers,
Int32 culture, String[] namedParameters )
at System.RuntimeT ype.InvokeMembe r(String name, BindingFlags
invokeAttr, Binder binder, Object target, Object[] args,
ParameterModifi er[] modifiers, CultureInfo culture, String[]
namedParameters )
at System.Type.Inv okeMember(Strin g name, BindingFlags invokeAttr,
Binder binder, Object target, Object[] args)
at System.Web.Mail .LateBoundAcces sHelper.SetProp (Type type, Object
obj, String propName, Object propValue)
at System.Web.Mail .LateBoundAcces sHelper.SetProp (Object obj, String
propName, Object propValue)
--- End of inner exception stack trace ---
at System.Web.Mail .LateBoundAcces sHelper.SetProp (Object obj, String
propName, Object propValue)
at System.Web.Mail .CdoSysHelper.S end(MailMessage message)
at System.Web.Mail .SmtpMail.Send( MailMessage message)
at TestArea.suq.Bu tton1_Click(Obj ect sender, EventArgs e) in
c:\inetpub\wwwr oot\testarea\su q.aspx.cs:line 69
----------------------
InnerException:
System.Reflecti on.TargetInvoca tionException: Exception has been thrown
by the target of an invocation. --->
System.Runtime. InteropServices .COMException (0x80040605): Unknown
Error
--- End of inner exception stack trace ---
at System.RuntimeT ype.InvokeDispM ethod(String name, BindingFlags
invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers,
Int32 culture, String[] namedParameters )
at System.RuntimeT ype.InvokeMembe r(String name, BindingFlags
invokeAttr, Binder binder, Object target, Object[] args,
ParameterModifi er[] modifiers, CultureInfo culture, String[]
namedParameters )
at System.Type.Inv okeMember(Strin g name, BindingFlags invokeAttr,
Binder binder, Object target, Object[] args)
at System.Web.Mail .LateBoundAcces sHelper.SetProp (Type type, Object
obj, String propName, Object propValue)
at System.Web.Mail .LateBoundAcces sHelper.SetProp (Object obj, String
propName, Object propValue)

Here is my code:
MailMessage mailMessage = new MailMessage();

mailMessage.To = "ac*****@smu.ed u";
mailMessage.Sub ject = "This bug sucks ass.";
mailMessage.Bod yFormat = MailFormat.Html ;
mailMessage.Bod y = "aaaaa";
mailMessage.Fro m = "aa*****@smu.ed u";

SmtpMail.SmtpSe rver.Insert(0, "www.smu.ed u");
try
{
SmtpMail.Send(m ailMessage);
}
catch (Exception ex)
{
Response.Write( "<pre>");
Response.Write( ex.ToString());

while (ex.InnerExcept ion != null)
{
Response.Write( "\n----------------------\n");
Response.Write( "InnerException :\n" + ex.ToString());
ex = ex.InnerExcepti on;
}
Response.Write( "</pre");
}

Any clues?

Aren


User submitted from AEWNET (http://www.aewnet.com/)
Nov 19 '05 #5

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

Similar topics

5
4570
by: Simran | last post by:
I need to set up an automated email system , which means users should not be able to respond back to the emails but at the same time, we need to track bounced emails. This is important as our customers are paying for this service, so we need to track the bounced email Id's. This is the code which I have tried:- MailMessage msgRequest = new MailMessage(); msgRequest.BodyFormat = MailFormat.Text; msgRequest.Subject = "Do Not reply to...
5
2236
by: martin | last post by:
Hi, I have created a class that is totally seperate from my web application. However this class is used extensivly by the web application for stuff like data access. I wish to add a function to this class that will send email, however my class will not seem to recognise the system.web.mail.mailmessage. my first impression on this is that I may have to use some sort of third
1
6343
by: mg | last post by:
I'd like to send a single e-mail message message that uses the escape character \n as well as the html tag <i> in the body How can I combine the two parts of this merssage message.BodyFormat = MailFormat.Text String msgTextA = "\n\nFrom: Carol Johnson\n\nSent: Monday, February 9, 2004 message.BodyFormat = MailFormat.Html String msgTextB = "<i> Inventory Control <i>
3
1544
by: Nick Brown | last post by:
Has any1 else had this error message. If so how do u solve it? The specified module could not be found. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.IO.FileNotFoundException: The specified module could not be found. Source Error:
3
2245
by: Brian Farnhill (MCP VB.NET) | last post by:
Hi, I am having some trouble using the MailMessage object to send an email with more than one attachment. I am working on a web based application where a user can submit information, along with a number of files. The information, including the file is stored in the database, and an email is sent with the information and any files that were submitted are attached. The system works fine when a user makes a submission that has no...
1
1200
by: VB Programmer | last post by:
I am making a simple VB.NET app to send emails. I put a test button on the form with code like this: Imports System.Web.Mail : Dim msgEmail As New System.Web.Mail.MailMessage With msgEmail .To = txtTestEmailAddress.Text .From = "someone@somewhere.com" .Body = "This is a test email."
3
4557
by: Gerard | last post by:
Hello I have created a windows service to monitor a database, it starts some checks when a timer elapses. The checks send emails depending on their findings. My issue is that when I created a windows application it worked fine, however I need to use a service as I don't want to rely on a user being logged in. The errors I get are: Index #:System.Web.HttpException: Could not access 'CDO.Message' object. --->...
2
1160
by: tma | last post by:
It appears that even though my mailmessage.bodyformat is set to mailformat.html, my html is being stripped out of the .body string in the code below. Anyone have any thoughts on why this happens? ..From = "tommy@***.net" ..To = oApplicant.Email ..Bcc = ""
3
1448
by: Essa | last post by:
Hi; I am using ASP.NET 1.0 and Mail.Mailmessage class to send emial and I have used it for sending text email, now I have to send an email with Embadded image into that email, how to do that using the same class and ASP.NET 1.0 using VB.NET. I am using following code: Dim Msg As New Mail.MailMessage
0
8712
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9316
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9077
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9021
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6637
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5951
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4727
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2524
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2113
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.