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

Sending email with System.Web.Mail fails with BodyFormat=Html

P: n/a
I'm sending email from my ASP.NET 1.1 app, and it works fine providing the
BodyFormat of the System.Web.Mail.MailMessage is set to Text.

If I change to Html format, it breaks. Here's the code:

Me.Msg = New System.Web.Mail.MailMessage

With Me.Msg

.To = "someToAddress"
.From = "someFromAddress"
.Subject = "subject"
.BodyFormat = Mail.MailFormat.Html
.Body = someTextString
.Priority = MailPriority.Normal

End With

SmtpMail.SmtpServer = "mySmtpServer"
SmtpMail.Send(Me.Msg)

This works fine if the format is Mail.MailFormat.Text, but not Html.

Would greatly appreciate any clues as to cause and cure..

The exception (and inner exception) I get is as follows:

Could not access 'CDO.Message' object.

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 InTouchWeb.EmailSender.SendEmail() in
c:\inetpub\wwwroot\InTouchWeb\EmailSender.vb:line 36

--------------------------------

Exception has been thrown by the target of an invocation.

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)
Apr 24 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Is mySmtpServer really your smtp server, or is it 'local' through IIS or a
'mail.xxxx.com' server available? -greg

"ChrisA" <c@a> wrote in message
news:44**********************@ptn-nntp-reader02.plus.net...
I'm sending email from my ASP.NET 1.1 app, and it works fine providing the
BodyFormat of the System.Web.Mail.MailMessage is set to Text.

If I change to Html format, it breaks. Here's the code:

Me.Msg = New System.Web.Mail.MailMessage

With Me.Msg

.To = "someToAddress"
.From = "someFromAddress"
.Subject = "subject"
.BodyFormat = Mail.MailFormat.Html
.Body = someTextString
.Priority = MailPriority.Normal

End With

SmtpMail.SmtpServer = "mySmtpServer"
SmtpMail.Send(Me.Msg)

This works fine if the format is Mail.MailFormat.Text, but not Html.

Would greatly appreciate any clues as to cause and cure..

The exception (and inner exception) I get is as follows:

Could not access 'CDO.Message' object.

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 InTouchWeb.EmailSender.SendEmail() in
c:\inetpub\wwwroot\InTouchWeb\EmailSender.vb:line 36

--------------------------------

Exception has been thrown by the target of an invocation.

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)

Apr 25 '06 #2

P: n/a
I've tried it using two smtp servers, one by specifying the IP address of
the server that will eventually be hosting the web application. And also
the smtp server I use for normal email, provided by my ISP. In each case,
it works fine with .BodyFormat = Mail.MailFormat.Text, but not Html.

Chris

"hazz" <ha**@sonic.net> wrote in message
news:OI**************@TK2MSFTNGP04.phx.gbl...
Is mySmtpServer really your smtp server, or is it 'local' through IIS or a
'mail.xxxx.com' server available? -greg

"ChrisA" <c@a> wrote in message
news:44**********************@ptn-nntp-reader02.plus.net...
I'm sending email from my ASP.NET 1.1 app, and it works fine providing
the
BodyFormat of the System.Web.Mail.MailMessage is set to Text.

If I change to Html format, it breaks. Here's the code:

Me.Msg = New System.Web.Mail.MailMessage

With Me.Msg

.To = "someToAddress"
.From = "someFromAddress"
.Subject = "subject"
.BodyFormat = Mail.MailFormat.Html
.Body = someTextString
.Priority = MailPriority.Normal

End With

SmtpMail.SmtpServer = "mySmtpServer"
SmtpMail.Send(Me.Msg)

This works fine if the format is Mail.MailFormat.Text, but not Html.

Would greatly appreciate any clues as to cause and cure..

The exception (and inner exception) I get is as follows:

Could not access 'CDO.Message' object.

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 InTouchWeb.EmailSender.SendEmail() in
c:\inetpub\wwwroot\InTouchWeb\EmailSender.vb:line 36

--------------------------------

Exception has been thrown by the target of an invocation.

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)


May 6 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.