473,407 Members | 2,359 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,407 software developers and data experts.

Send email error : could not access 'cdo.message' object.

Hello.
I have a strange question about send email in .net.
I use the following code to send email.

Sub SendMail(ByVal mailFrom As String, _
ByVal mailTo As String, _
ByVal mailSubject As String, _
ByVal mailServer As String, _
ByVal mailBody As String)
Dim mm As New System.Web.Mail.MailMessage
Dim Mail As System.Web.Mail.SmtpMail
mm.From = mailFrom
mm.To = mailTo
mm.Subject = mailSubject
mm.Body = mailBody
mm.BodyFormat = System.Web.Mail.MailFormat.Html
Mail.SmtpServer = mailServer
Mail.Send(mm)
End Sub

I get this error:

System.Web.HttpException: could not access 'cdo.message' object.

but if I instead

"Mail.SmtpServer = mailServer"

to

"Mail.SmtpServer.Insert(0, mailServer)"

the program can run correctly.

Do you know why? Thanks in advance.

Jun 22 '06 #1
1 1446

Have a read of this:
http://blogs.msdn.com/mstehle/archiv...23/496418.aspx

Cheers,

ChrisM.

"liuage" <li****@discussions.microsoft.com> wrote in message
news:B9**********************************@microsof t.com...
Hello.
I have a strange question about send email in .net.
I use the following code to send email.

Sub SendMail(ByVal mailFrom As String, _
ByVal mailTo As String, _
ByVal mailSubject As String, _
ByVal mailServer As String, _
ByVal mailBody As String)
Dim mm As New System.Web.Mail.MailMessage
Dim Mail As System.Web.Mail.SmtpMail
mm.From = mailFrom
mm.To = mailTo
mm.Subject = mailSubject
mm.Body = mailBody
mm.BodyFormat = System.Web.Mail.MailFormat.Html
Mail.SmtpServer = mailServer
Mail.Send(mm)
End Sub

I get this error:

System.Web.HttpException: could not access 'cdo.message' object.

but if I instead

"Mail.SmtpServer = mailServer"

to

"Mail.SmtpServer.Insert(0, mailServer)"

the program can run correctly.

Do you know why? Thanks in advance.


Jun 23 '06 #2

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

Similar topics

8
by: Samia | last post by:
I have an application running on a single workstation (win 2000) with Outlook installed and a profile create using and exchange server with authentification through the DNS. This user profile is...
3
by: Salim Afþar | last post by:
Hi, I'm using CDO object to send email but it doesn't send any email and it does not give an error. My code look like this: Dim iMsg2 Dim iConf2 Dim Flds2 Const cdoSendUsingPort = 2 set...
6
by: DigitalRick | last post by:
I have been running CDONTS in my ASPpages to send emails to me sent from my guestbook. It had been working fine untill I upgraded to Server 2003 (I am also running Exchange 2003) all locally. I...
3
by: Jens | last post by:
Hi I am writing a ASP.NET web application that must sent some e-mails. I get the exception “Could not access 'CDO.Message' object†when I call SmtpMail.Send. This only happens when I send...
4
by: Aren Cambre | last post by:
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...
3
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...
2
by: Ryan | last post by:
Hi, I receive an access denied error (see below) when attempting to send an email with BodyFormat=MailFormat.Html from an asp.net page. Exactly the same code works fine in a console...
9
by: JBuckner | last post by:
My macro uses the Send Object (VBA Item.Send) function to email a spreadsheet to an Outlook contact list. I want the function to be completely automatic but Outlook displays a security warning...
1
by: chaitanya02 | last post by:
Hi All, Well- this question might have appeared several times on this forum- but would appreciate your reply on this: I have a asp page, where customers login with some username and the pwd,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: 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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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,...
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...

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.