Urgent SendMail Problem

  • Thread starter Andrea Williams
  • Start date
A

Andrea Williams

I have been using this code for a while now and I haven't changed this code
for at least a couple weeks... I do not suspect the code. The error I'm
getting is the following:

Message: Could not access 'CDO.Message' object.

StackTrace: at System.Web.Mail.LateBoundAccessHelper.CallMethod(Object obj,
String methodName, Object[] args)
at System.Web.Mail.CdoSysHelper.Send(MailMessage message)
at System.Web.Mail.CdoSysHelper.Send(String from, String to, String subject,
String messageText)
at System.Web.Mail.SmtpMail.Send(String from, String to, String subject,
String messageText)
at DSI.CIS.UserRegister.btnSubmit_Click(Object sender, EventArgs e) in
c:\inetpub\wwwroot\DSI\CIS\UserRegister.aspx.cs:line 524

TargetSite: System.Object CallMethod(System.Object, System.String,
System.Object[])

InnerException: System.Reflection.TargetInvocationException: Exception has
been thrown by the target of an invocation. --->
System.Runtime.InteropServices.COMException (0x80040213): The transport
failed to connect to the server.

--- End of inner exception stack trace ---
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(Object obj, String
methodName, Object[] args)

HelpLink:


The line of code that is failing is this:
System.Web.Mail.SmtpMail.Send(this.HomeOfficeEmail, oUser.Email,

oEmailMessage.Subject, oEmailMessage.Body);

I stepped through the code and all the values are correct so I can only
assume that something is wrong with .NET itself.

Any help would be appreciated!!!

Andrea
 
K

Ken Cox [Microsoft MVP]

Did anyone change anything on the SMTP server? The ASP.NET account could
have expired, relaying could be turned off, the IP address could change.

Did anyone change/uninstall CDO on the Web server or change the permissions?

Just tossing out some ideas of things that have been known to cause problems
with email sending.

Ken
 
B

bruce barker

the smtp server is rejecting the connection, or is not found. check that the
stmpp servername is valid, that is it running, allows anonymous access, and
relaying from your asp.net server.

-- bruce (sqlwork.com)


| I have been using this code for a while now and I haven't changed this
code
| for at least a couple weeks... I do not suspect the code. The error I'm
| getting is the following:
|
| Message: Could not access 'CDO.Message' object.
|
| StackTrace: at System.Web.Mail.LateBoundAccessHelper.CallMethod(Object
obj,
| String methodName, Object[] args)
| at System.Web.Mail.CdoSysHelper.Send(MailMessage message)
| at System.Web.Mail.CdoSysHelper.Send(String from, String to, String
subject,
| String messageText)
| at System.Web.Mail.SmtpMail.Send(String from, String to, String subject,
| String messageText)
| at DSI.CIS.UserRegister.btnSubmit_Click(Object sender, EventArgs e) in
| c:\inetpub\wwwroot\DSI\CIS\UserRegister.aspx.cs:line 524
|
| TargetSite: System.Object CallMethod(System.Object, System.String,
| System.Object[])
|
| InnerException: System.Reflection.TargetInvocationException: Exception has
| been thrown by the target of an invocation. --->
| System.Runtime.InteropServices.COMException (0x80040213): The transport
| failed to connect to the server.
|
| --- End of inner exception stack trace ---
| 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(Object obj, String
| methodName, Object[] args)
|
| HelpLink:
|
|
| The line of code that is failing is this:
| System.Web.Mail.SmtpMail.Send(this.HomeOfficeEmail, oUser.Email,
|
| oEmailMessage.Subject, oEmailMessage.Body);
|
| I stepped through the code and all the values are correct so I can only
| assume that something is wrong with .NET itself.
|
| Any help would be appreciated!!!
|
| Andrea
|
|
 
A

Andrea Williams

Further investigation finds this... If I turn off the connection security
(allow all) on the SMTP server AND allow all to relay, the Send mail works.
However, I don't like this solution as it opens security holes big time!

The only thing I can think of that has changed is that I installed the .NET
1.1 SP 1 and a security patch (KB833987). I suspect it broke something.
Before I was able to set the Connection security to only allow my IP address
and only allow my system to relay. Now that doesn't work.

I tried un-installing the SP for .NET, but still have the same problem. So
I'm thinking that it changed something permenantly and uninstall didn't
reset it.

Incidently, if I set the Connection security to exclude all but my IP, the
email bombs. If I open that back up and set the relay to exclude all except
my IP it also bombs.

Andrea

Ken Cox said:
Did anyone change anything on the SMTP server? The ASP.NET account could
have expired, relaying could be turned off, the IP address could change.

Did anyone change/uninstall CDO on the Web server or change the permissions?

Just tossing out some ideas of things that have been known to cause problems
with email sending.

Ken


Andrea Williams said:
I have been using this code for a while now and I haven't changed this code
for at least a couple weeks... I do not suspect the code. The error I'm
getting is the following:

Message: Could not access 'CDO.Message' object.

StackTrace: at System.Web.Mail.LateBoundAccessHelper.CallMethod(Object
obj,
String methodName, Object[] args)
at System.Web.Mail.CdoSysHelper.Send(MailMessage message)
at System.Web.Mail.CdoSysHelper.Send(String from, String to, String
subject,
String messageText)
at System.Web.Mail.SmtpMail.Send(String from, String to, String subject,
String messageText)
at DSI.CIS.UserRegister.btnSubmit_Click(Object sender, EventArgs e) in
c:\inetpub\wwwroot\DSI\CIS\UserRegister.aspx.cs:line 524

TargetSite: System.Object CallMethod(System.Object, System.String,
System.Object[])

InnerException: System.Reflection.TargetInvocationException: Exception has
been thrown by the target of an invocation. --->
System.Runtime.InteropServices.COMException (0x80040213): The transport
failed to connect to the server.

--- End of inner exception stack trace ---
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(Object obj, String
methodName, Object[] args)

HelpLink:


The line of code that is failing is this:
System.Web.Mail.SmtpMail.Send(this.HomeOfficeEmail, oUser.Email,

oEmailMessage.Subject, oEmailMessage.Body);

I stepped through the code and all the values are correct so I can only
assume that something is wrong with .NET itself.

Any help would be appreciated!!!

Andrea
 
A

Andrea Williams

I installed sp1 for .NET 1.1 and a security patch (KB833987) as I have just
told Ken Cox. The frustrating thing is that this was all working
correctly... I seem to remember uninstalling the SP, but it didn't fix the
problem. I was in a hurry at the time to finish up for a conference so I
left it until I returned.

I am the only one who modifies these servers and the Win03 box that is doing
this is the only one where I've installed the update and the only box with
this behavior. Since then, the live server at the ISP has started doing the
same thing and it is a Win2K box, and doesn't need that particular security
patch, so I suspect the Service Pack. (Read the previous post) I asure you
that my work around for this issue will NOT work for the ISP and I can't say
that I like it much either.

If you have any other suggestion, please let me know,
Andrea


bruce barker said:
the smtp server is rejecting the connection, or is not found. check that the
stmpp servername is valid, that is it running, allows anonymous access, and
relaying from your asp.net server.

-- bruce (sqlwork.com)


| I have been using this code for a while now and I haven't changed this
code
| for at least a couple weeks... I do not suspect the code. The error I'm
| getting is the following:
|
| Message: Could not access 'CDO.Message' object.
|
| StackTrace: at System.Web.Mail.LateBoundAccessHelper.CallMethod(Object
obj,
| String methodName, Object[] args)
| at System.Web.Mail.CdoSysHelper.Send(MailMessage message)
| at System.Web.Mail.CdoSysHelper.Send(String from, String to, String
subject,
| String messageText)
| at System.Web.Mail.SmtpMail.Send(String from, String to, String subject,
| String messageText)
| at DSI.CIS.UserRegister.btnSubmit_Click(Object sender, EventArgs e) in
| c:\inetpub\wwwroot\DSI\CIS\UserRegister.aspx.cs:line 524
|
| TargetSite: System.Object CallMethod(System.Object, System.String,
| System.Object[])
|
| InnerException: System.Reflection.TargetInvocationException: Exception has
| been thrown by the target of an invocation. --->
| System.Runtime.InteropServices.COMException (0x80040213): The transport
| failed to connect to the server.
|
| --- End of inner exception stack trace ---
| 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(Object obj, String
| methodName, Object[] args)
|
| HelpLink:
|
|
| The line of code that is failing is this:
| System.Web.Mail.SmtpMail.Send(this.HomeOfficeEmail, oUser.Email,
|
| oEmailMessage.Subject, oEmailMessage.Body);
|
| I stepped through the code and all the values are correct so I can only
| assume that something is wrong with .NET itself.
|
| Any help would be appreciated!!!
|
| Andrea
|
|
 
A

Andrea Williams

Oh yes, I checked and the ASPNET account is set to never expireand the SMTP
is set to allow anonymous...
Andrea


bruce barker said:
the smtp server is rejecting the connection, or is not found. check that the
stmpp servername is valid, that is it running, allows anonymous access, and
relaying from your asp.net server.

-- bruce (sqlwork.com)


| I have been using this code for a while now and I haven't changed this
code
| for at least a couple weeks... I do not suspect the code. The error I'm
| getting is the following:
|
| Message: Could not access 'CDO.Message' object.
|
| StackTrace: at System.Web.Mail.LateBoundAccessHelper.CallMethod(Object
obj,
| String methodName, Object[] args)
| at System.Web.Mail.CdoSysHelper.Send(MailMessage message)
| at System.Web.Mail.CdoSysHelper.Send(String from, String to, String
subject,
| String messageText)
| at System.Web.Mail.SmtpMail.Send(String from, String to, String subject,
| String messageText)
| at DSI.CIS.UserRegister.btnSubmit_Click(Object sender, EventArgs e) in
| c:\inetpub\wwwroot\DSI\CIS\UserRegister.aspx.cs:line 524
|
| TargetSite: System.Object CallMethod(System.Object, System.String,
| System.Object[])
|
| InnerException: System.Reflection.TargetInvocationException: Exception has
| been thrown by the target of an invocation. --->
| System.Runtime.InteropServices.COMException (0x80040213): The transport
| failed to connect to the server.
|
| --- End of inner exception stack trace ---
| 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(Object obj, String
| methodName, Object[] args)
|
| HelpLink:
|
|
| The line of code that is failing is this:
| System.Web.Mail.SmtpMail.Send(this.HomeOfficeEmail, oUser.Email,
|
| oEmailMessage.Subject, oEmailMessage.Body);
|
| I stepped through the code and all the values are correct so I can only
| assume that something is wrong with .NET itself.
|
| Any help would be appreciated!!!
|
| Andrea
|
|
 
A

Andrea Williams

New info!

Going on the premise that the CDO.Message object was not firing based on
some kind of permission, I looked for the dll for the object
(cdosys.dll). I looked at the security tab on that dll and found that
compared to other dll's, the "Users" group was not given permission to
execute the dll. I added the permission and added the connection security
back to SMTP that had made SMTP fail. Then I tested my email send again. It
worked!

So my question is, why did one of the patches take the security group off of
the dll in the first place?

Andrea
 
A

Andrea Williams

Ok, I was wrong... The last thing I did only made it worked if the user was
NOT logged in to my app. I'm using Form Authenitication with my database
info and once I'm logged into my app, the email will no longer send... same
error as before.

I added the Everyone permission to the cdosys.dll and that didn't fix it, so
now I'm stumped.

Andrea
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top