472,779 Members | 1,824 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,779 software developers and data experts.

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

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

Jens Øster, Vestas

Here you can see my code


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

Dim SmtpMail As Mail.SmtpMail
SmtpMail.SmtpServer = "MyMailServerName"

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 2615

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

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...
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...
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...
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...
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. --->...
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. ...
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...
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
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"
by: Rina0 | last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
by: lllomh | last post by:
How does React native implement an English player?
by: Mushico | last post by:
How to calculate date of retirement from date of birth
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.