473,419 Members | 1,588 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,419 software developers and data experts.

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

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
2 2652
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Francois Keyeux | last post by:
hello everyone: i have a web site built using vbasic active server scripting running on iis (it works on either iis 50 and 60, but is designed for iis 50) i know how to create a plain text...
2
by: Paul Turley | last post by:
Does anyone have some sample code for sending an HTML formatted message using CDONTS? Thanks RE: Sending HTML formatted mail using CDONTS -- Paul Turley, MCSD, MCAD, MCT, MSF...
5
by: Das | last post by:
Hi, I'm trying to email html page & that page also contains the images. I can do that when we send html page from ms outlook. But I want to attach page c# code & send the mail through smtp mail....
4
by: Justin | last post by:
I have a fairly large piece of html, about 50 lines that I would like to send via an ASP.NET page I was wondering what would be the best and cleanest way to do this? Is there a way I can put the...
7
by: Ray Booysen | last post by:
Hi all I'm sending email via ASP.NET in HTML mode. Each email has exactly one attachment and I do have full access to the SMTP server. However, if I send the email in HTML format, the...
2
by: stew dean | last post by:
Hi, I'm a newbie so go easy. I'm having to covert an old site I've done to run in a .net environment and have limited time to do this. What I've learnt so far is the ideal way to do this is...
1
by: robbiesmith79 | last post by:
Just so this is out there on the web, I battled the past 24 hours about this. Background info... I developed a ecommerce website in PHP 4 on a shared linux hosting plan from GoDaddy and had the...
2
by: =?Utf-8?B?Q2FwdGFpbiBEYXZlIQ==?= | last post by:
I wrote some code to send an email with two alternate views: 1) html 2) plain text All the html enabled email clients accept the html just fine and disregard the plain text version. However,...
2
by: Aneesh Pulukkul[MCSD.Net] | last post by:
Hi, I have a HTML page and associated images. I need to send the HTML as email -the email should also display the images at respective places. So am sending the content of HTML file as...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
0
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...
0
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...

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.