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

SmtpMail.Send - Exception "Could not access 'CDO.Message' object"

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 e-mail addresses out side my company walls. When the e-mail is send on some one in my company it works perfect.

I think it is a relay issue. Our system administrator will not allow relaying.

In the ASP.Net web.config file I let the web application impersonate a specific user that has a mail account on our mail server:

<identity impersonate="true" userName="MyDon\MyUserName" password="zzzz" />

The web server and the mail server are two different physical computers.

I have two questions:
1) How can I fix the problem?
2) Is it a relay issue? If yes, what can I do to fix it? Is it OK to allow relaying on a mail server?

Below you can se my code and the exceptions

Regards
Jens Øster, Vestas

Here you can see my code

Try

Mail.From = tbFrom.Text
Mail.To = tbTo.Text
Mail.Subject = tbSubject.Text
Mail.Body = tbMessage.Text

Dim SmtpMail As Mail.SmtpMail
SmtpMail.SmtpServer = "MyMailServerName"
SmtpMail.Send(Mail)

Catch ex As Exception

While (Not ex.InnerException Is Nothing)
Response.Write( _
"<b>Message:</b> " & ex.Message & "<br>" & _
"<b>Source:</b> " & ex.Source & "<br>" & _
"<b>StackTrace:</b> " & ex.StackTrace & "<br>" & _
"<b>HelpLink:</b> " & ex.HelpLink & "<br>" & _
"<b>UserName:</b> " & User.Identity.Name & "<br><br>")
ex = ex.InnerException
End While
End Try

Message: Could not access 'CDO.Message' object.
Source: System.Web
StackTrace: at System.Web.Mail.LateBoundAccessHelper.CallMethod(O bject obj, String methodName, Object[] args) at System.Web.Mail.CdoSysHelper.Send(MailMessage message) at System.Web.Mail.SmtpMail.Send(MailMessage message) at NCR2.SendMail.btSend_Click(Object sender, EventArgs e) in C:\Inetpub\wwwroot\NCR2\SendMail.aspx.vb:line 79

Message: Exception has been thrown by the target of an invocation.
Source: mscorlib
StackTrace: 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.Web.Mail.LateBoundAccessHelper.CallMethod(O bject obj, String methodName, Object[] args)

Nov 18 '05 #1
1 2671

"Jens ster" <Jens st**@discussions.microsoft.com> wrote in message news:AB**********************************@microsof t.com...
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.


A tip: when you examine that message in the debugger, you might see a better
reason for the error. The "Could not access" is shown regardless of the real reason.

Hans Kesting
Nov 18 '05 #2

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

Similar topics

1
by: M D | last post by:
For the code see MS knowledge base #310273. All I did was comment out the parts for adding an attachment and put real values in for smtpServer & email addresses. For the SmtpServer I used my...
1
by: Kamal | last post by:
I am trying to send mail through smtp. smtp service is running on my machine. But every time during the smtpmail.send(msg) call gives "Could not access 'CDO.Message' object." error. Could some...
3
by: Jibu | last post by:
Hi I am using SmtpMail class for mail sending. I could able to send mail using my mailse server to our LAN. But when I tried external addresses it showed the exception Message "Could not...
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: Liz Patton | last post by:
Here's the exception: System.Exception: Unable to send mail: Could not access 'CDO.Message' object. ---> System.Web.HttpException: Could not access 'CDO.Message' object. --->...
2
by: chuckdfoster | last post by:
I am getting a "Could Not Access CDO.Message Object" Error when I try to use the following code to send an email via ASP.NET. When I run this on one machine it works, on another one it doesn't. ...
1
by: Jason | last post by:
I am trying to send mail via SMTP, using VB.NET on XP. I keep getting this error: "Could not access 'CDO.Message' object." (I can send mail fine via VB6, using CDONTS.) I have added a reference...
4
farooqbob
by: farooqbob | last post by:
When i sending a HTML mail I getting this Erro "could not access "CDO.Message" object" How can i fix this problem
1
by: ashish | last post by:
Dim oCon Err.Clear Set oCon = Server.CreateObject("ADODB.Connection") If Err.Number = 0 Then '// '// Open an ADODB.Connection to the folder URL '// oCon.Provider = "ExOLEDB.DataSource"
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, youll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shllpp 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.