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

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

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a

"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 discussion thread is closed

Replies have been disabled for this discussion.