By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,480 Members | 771 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,480 IT Pros & Developers. It's quick & easy.

When MailMessage.BodyFormat = MailFormat.Html, SmtpMail.Send throws exception

P: n/a
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.HttpException: Could not access 'CDO.Message' object. --->
System.Reflection.TargetInvocationException: 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.RuntimeType.InvokeDispMethod(String name, BindingFlags
invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers,
Int32 culture, String[] namedParameters)
at System.RuntimeType.InvokeMember(String name, BindingFlags
invokeAttr, Binder binder, Object target, Object[] args,
ParameterModifier[] modifiers, CultureInfo culture, String[]
namedParameters)
at System.Type.InvokeMember(String name, BindingFlags invokeAttr,
Binder binder, Object target, Object[] args)
at System.Web.Mail.LateBoundAccessHelper.SetProp(Type type, Object
obj, String propName, Object propValue)
at System.Web.Mail.LateBoundAccessHelper.SetProp(Obje ct obj, String
propName, Object propValue)
--- End of inner exception stack trace ---
at System.Web.Mail.LateBoundAccessHelper.SetProp(Obje ct obj, String
propName, Object propValue)
at System.Web.Mail.CdoSysHelper.Send(MailMessage message)
at System.Web.Mail.SmtpMail.Send(MailMessage message)
at TestArea.suq.Button1_Click(Object sender, EventArgs e) in
c:\inetpub\wwwroot\testarea\suq.aspx.cs:line 69
----------------------
InnerException:
System.Web.HttpException: Could not access 'CDO.Message' object. --->
System.Reflection.TargetInvocationException: 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.RuntimeType.InvokeDispMethod(String name, BindingFlags
invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers,
Int32 culture, String[] namedParameters)
at System.RuntimeType.InvokeMember(String name, BindingFlags
invokeAttr, Binder binder, Object target, Object[] args,
ParameterModifier[] modifiers, CultureInfo culture, String[]
namedParameters)
at System.Type.InvokeMember(String name, BindingFlags invokeAttr,
Binder binder, Object target, Object[] args)
at System.Web.Mail.LateBoundAccessHelper.SetProp(Type type, Object
obj, String propName, Object propValue)
at System.Web.Mail.LateBoundAccessHelper.SetProp(Obje ct obj, String
propName, Object propValue)
--- End of inner exception stack trace ---
at System.Web.Mail.LateBoundAccessHelper.SetProp(Obje ct obj, String
propName, Object propValue)
at System.Web.Mail.CdoSysHelper.Send(MailMessage message)
at System.Web.Mail.SmtpMail.Send(MailMessage message)
at TestArea.suq.Button1_Click(Object sender, EventArgs e) in
c:\inetpub\wwwroot\testarea\suq.aspx.cs:line 69
----------------------
InnerException:
System.Reflection.TargetInvocationException: 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.RuntimeType.InvokeDispMethod(String name, BindingFlags
invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers,
Int32 culture, String[] namedParameters)
at System.RuntimeType.InvokeMember(String name, BindingFlags
invokeAttr, Binder binder, Object target, Object[] args,
ParameterModifier[] modifiers, CultureInfo culture, String[]
namedParameters)
at System.Type.InvokeMember(String name, BindingFlags invokeAttr,
Binder binder, Object target, Object[] args)
at System.Web.Mail.LateBoundAccessHelper.SetProp(Type type, Object
obj, String propName, Object propValue)
at System.Web.Mail.LateBoundAccessHelper.SetProp(Obje ct obj, String
propName, Object propValue)

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

mailMessage.To = "ac*****@smu.edu";
mailMessage.Subject = "This bug sucks ass.";
mailMessage.BodyFormat = MailFormat.Html;
mailMessage.Body = "aaaaa";
mailMessage.From = "aa*****@smu.edu";

SmtpMail.SmtpServer.Insert(0, "www.smu.edu");
try
{
SmtpMail.Send(mailMessage);
}
catch (Exception ex)
{
Response.Write("<pre>");
Response.Write(ex.ToString());

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

Any clues?

Aren
Nov 18 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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.smu.edu> wrote in message
news:da**************************@posting.google.c om...
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.HttpException: Could not access 'CDO.Message' object. --->
System.Reflection.TargetInvocationException: 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.RuntimeType.InvokeDispMethod(String name, BindingFlags
invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers,
Int32 culture, String[] namedParameters)
at System.RuntimeType.InvokeMember(String name, BindingFlags
invokeAttr, Binder binder, Object target, Object[] args,
ParameterModifier[] modifiers, CultureInfo culture, String[]
namedParameters)
at System.Type.InvokeMember(String name, BindingFlags invokeAttr,
Binder binder, Object target, Object[] args)
at System.Web.Mail.LateBoundAccessHelper.SetProp(Type type, Object
obj, String propName, Object propValue)
at System.Web.Mail.LateBoundAccessHelper.SetProp(Obje ct obj, String
propName, Object propValue)
--- End of inner exception stack trace ---
at System.Web.Mail.LateBoundAccessHelper.SetProp(Obje ct obj, String
propName, Object propValue)
at System.Web.Mail.CdoSysHelper.Send(MailMessage message)
at System.Web.Mail.SmtpMail.Send(MailMessage message)
at TestArea.suq.Button1_Click(Object sender, EventArgs e) in
c:\inetpub\wwwroot\testarea\suq.aspx.cs:line 69
----------------------
InnerException:
System.Web.HttpException: Could not access 'CDO.Message' object. --->
System.Reflection.TargetInvocationException: 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.RuntimeType.InvokeDispMethod(String name, BindingFlags
invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers,
Int32 culture, String[] namedParameters)
at System.RuntimeType.InvokeMember(String name, BindingFlags
invokeAttr, Binder binder, Object target, Object[] args,
ParameterModifier[] modifiers, CultureInfo culture, String[]
namedParameters)
at System.Type.InvokeMember(String name, BindingFlags invokeAttr,
Binder binder, Object target, Object[] args)
at System.Web.Mail.LateBoundAccessHelper.SetProp(Type type, Object
obj, String propName, Object propValue)
at System.Web.Mail.LateBoundAccessHelper.SetProp(Obje ct obj, String
propName, Object propValue)
--- End of inner exception stack trace ---
at System.Web.Mail.LateBoundAccessHelper.SetProp(Obje ct obj, String
propName, Object propValue)
at System.Web.Mail.CdoSysHelper.Send(MailMessage message)
at System.Web.Mail.SmtpMail.Send(MailMessage message)
at TestArea.suq.Button1_Click(Object sender, EventArgs e) in
c:\inetpub\wwwroot\testarea\suq.aspx.cs:line 69
----------------------
InnerException:
System.Reflection.TargetInvocationException: 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.RuntimeType.InvokeDispMethod(String name, BindingFlags
invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers,
Int32 culture, String[] namedParameters)
at System.RuntimeType.InvokeMember(String name, BindingFlags
invokeAttr, Binder binder, Object target, Object[] args,
ParameterModifier[] modifiers, CultureInfo culture, String[]
namedParameters)
at System.Type.InvokeMember(String name, BindingFlags invokeAttr,
Binder binder, Object target, Object[] args)
at System.Web.Mail.LateBoundAccessHelper.SetProp(Type type, Object
obj, String propName, Object propValue)
at System.Web.Mail.LateBoundAccessHelper.SetProp(Obje ct obj, String
propName, Object propValue)

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

mailMessage.To = "ac*****@smu.edu";
mailMessage.Subject = "This bug sucks ass.";
mailMessage.BodyFormat = MailFormat.Html;
mailMessage.Body = "aaaaa";
mailMessage.From = "aa*****@smu.edu";

SmtpMail.SmtpServer.Insert(0, "www.smu.edu");
try
{
SmtpMail.Send(mailMessage);
}
catch (Exception ex)
{
Response.Write("<pre>");
Response.Write(ex.ToString());

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

Any clues?

Aren

Nov 18 '05 #2

P: n/a
"bruce barker" <no***********@safeco.com> wrote in message news:<u1**************@TK2MSFTNGP11.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

P: n/a
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.smu.edu (Aren Cambre) wrote in message news:<da**************************@posting.google. com>...
"bruce barker" <no***********@safeco.com> wrote in message news:<u1**************@TK2MSFTNGP11.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

P: n/a

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.HttpException: Could not access 'CDO.Message' object. --->
System.Reflection.TargetInvocationException: 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.RuntimeType.InvokeDispMethod(String name, BindingFlags
invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers,
Int32 culture, String[] namedParameters)
at System.RuntimeType.InvokeMember(String name, BindingFlags
invokeAttr, Binder binder, Object target, Object[] args,
ParameterModifier[] modifiers, CultureInfo culture, String[]
namedParameters)
at System.Type.InvokeMember(String name, BindingFlags invokeAttr,
Binder binder, Object target, Object[] args)
at System.Web.Mail.LateBoundAccessHelper.SetProp(Type type, Object
obj, String propName, Object propValue)
at System.Web.Mail.LateBoundAccessHelper.SetProp(Obje ct obj, String
propName, Object propValue)
--- End of inner exception stack trace ---
at System.Web.Mail.LateBoundAccessHelper.SetProp(Obje ct obj, String
propName, Object propValue)
at System.Web.Mail.CdoSysHelper.Send(MailMessage message)
at System.Web.Mail.SmtpMail.Send(MailMessage message)
at TestArea.suq.Button1_Click(Object sender, EventArgs e) in
c:\inetpub\wwwroot\testarea\suq.aspx.cs:line 69
----------------------
InnerException:
System.Web.HttpException: Could not access 'CDO.Message' object. --->
System.Reflection.TargetInvocationException: 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.RuntimeType.InvokeDispMethod(String name, BindingFlags
invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers,
Int32 culture, String[] namedParameters)
at System.RuntimeType.InvokeMember(String name, BindingFlags
invokeAttr, Binder binder, Object target, Object[] args,
ParameterModifier[] modifiers, CultureInfo culture, String[]
namedParameters)
at System.Type.InvokeMember(String name, BindingFlags invokeAttr,
Binder binder, Object target, Object[] args)
at System.Web.Mail.LateBoundAccessHelper.SetProp(Type type, Object
obj, String propName, Object propValue)
at System.Web.Mail.LateBoundAccessHelper.SetProp(Obje ct obj, String
propName, Object propValue)
--- End of inner exception stack trace ---
at System.Web.Mail.LateBoundAccessHelper.SetProp(Obje ct obj, String
propName, Object propValue)
at System.Web.Mail.CdoSysHelper.Send(MailMessage message)
at System.Web.Mail.SmtpMail.Send(MailMessage message)
at TestArea.suq.Button1_Click(Object sender, EventArgs e) in
c:\inetpub\wwwroot\testarea\suq.aspx.cs:line 69
----------------------
InnerException:
System.Reflection.TargetInvocationException: 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.RuntimeType.InvokeDispMethod(String name, BindingFlags
invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers,
Int32 culture, String[] namedParameters)
at System.RuntimeType.InvokeMember(String name, BindingFlags
invokeAttr, Binder binder, Object target, Object[] args,
ParameterModifier[] modifiers, CultureInfo culture, String[]
namedParameters)
at System.Type.InvokeMember(String name, BindingFlags invokeAttr,
Binder binder, Object target, Object[] args)
at System.Web.Mail.LateBoundAccessHelper.SetProp(Type type, Object
obj, String propName, Object propValue)
at System.Web.Mail.LateBoundAccessHelper.SetProp(Obje ct obj, String
propName, Object propValue)

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

mailMessage.To = "ac*****@smu.edu";
mailMessage.Subject = "This bug sucks ass.";
mailMessage.BodyFormat = MailFormat.Html;
mailMessage.Body = "aaaaa";
mailMessage.From = "aa*****@smu.edu";

SmtpMail.SmtpServer.Insert(0, "www.smu.edu");
try
{
SmtpMail.Send(mailMessage);
}
catch (Exception ex)
{
Response.Write("<pre>");
Response.Write(ex.ToString());

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

Any clues?

Aren


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

This discussion thread is closed

Replies have been disabled for this discussion.