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

ASP.NET MailMessage in XP fails

P: n/a
Straightforward VB.NET 2002 code that works form both
Windows and ASP.NET apps on a Windows 2000 machine, and
works in the Windows app on a newly installed XP machine,
but fails in the ASP.NET code on XP. The unhandled
exception is "COMException: The 'SendUsing' configuration
value is invalid." If I handle the exception, the
exception's Message is "Could not access 'CDO.Message'
object."

The essence of the code is:
Imports System.Web.Mail
....
Dim m as New MailMessage()
m.From = ...set all properties
smtpmail.send(m)

There are no attachments, but adding attachments to any
of the 4 versions of the app does not change the results.
The smtp server is the local machine in all cases, and
changing that does not change the results.

I'd welcome any ideas.

Thanks.
Nov 17 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Hi Frank,

Does setting the SmtpServer property to "localhost" (or whatever your SMTP
server is) fix it? If not, try checking the ASPNET account's permissions on
the mailroot's folders.
--
Ray Dixon - Microsoft MVP
ra*@NOSPAM.greeble.com
(remove NOSPAM. from my e-mail address for a direct reply)
"Frank" <ft*****@nc.rr.com> wrote in message
news:00****************************@phx.gbl...
Straightforward VB.NET 2002 code that works form both
Windows and ASP.NET apps on a Windows 2000 machine, and
works in the Windows app on a newly installed XP machine,
but fails in the ASP.NET code on XP. The unhandled
exception is "COMException: The 'SendUsing' configuration
value is invalid." If I handle the exception, the
exception's Message is "Could not access 'CDO.Message'
object."

The essence of the code is:
Imports System.Web.Mail
...
Dim m as New MailMessage()
m.From = ...set all properties
smtpmail.send(m)

There are no attachments, but adding attachments to any
of the 4 versions of the app does not change the results.
The smtp server is the local machine in all cases, and
changing that does not change the results.

I'd welcome any ideas.

Thanks.

Nov 17 '05 #2

P: n/a
Ray - thanks for responding - but, no, setting the
SmtpServer property to either "localhost" or another
available (working) smtp server does not change anything
for better or worse.

I also made the ASPNET account (aspnet_wp, right?) an
administrator. I've had some trouble before from folders
that didn't have web sharing turned on, so I did that for
the mailroot and its subfolders - no change.

The message, "Could not access 'CDO.Message' object", and
the fact that mail works fine from Windows Forms apps on
the same machine, makes it sound like it's an ASP.NET or
IIS issue.

There were also some Windows 2003 Server questions today
on the same topic, but none of the responses shed any
light on this for me.

Do you have any more suggestions?

Thanks. Frank


-----Original Message-----
Hi Frank,

Does setting the SmtpServer property to "localhost" (or whatever your SMTPserver is) fix it? If not, try checking the ASPNET account's permissions onthe mailroot's folders.
--
Ray Dixon - Microsoft MVP
ra*@NOSPAM.greeble.com
(remove NOSPAM. from my e-mail address for a direct reply)

"Frank" <ft*****@nc.rr.com> wrote in message
news:00****************************@phx.gbl...
Straightforward VB.NET 2002 code that works form both
Windows and ASP.NET apps on a Windows 2000 machine, and
works in the Windows app on a newly installed XP machine, but fails in the ASP.NET code on XP. The unhandled
exception is "COMException: The 'SendUsing' configuration value is invalid." If I handle the exception, the
exception's Message is "Could not access 'CDO.Message'
object."

The essence of the code is:
Imports System.Web.Mail
...
Dim m as New MailMessage()
m.From = ...set all properties
smtpmail.send(m)

There are no attachments, but adding attachments to any
of the 4 versions of the app does not change the results. The smtp server is the local machine in all cases, and
changing that does not change the results.

I'd welcome any ideas.

Thanks.

.

Nov 17 '05 #3

P: n/a
Jacky -

There is only one level of InnerException, "The server
rejected one or more recipient addresses. The server
response was: 550 5.7.1 Unable to relay for
ft*****@nc.rr.com".

So my problem still is, why would the same code work from
a Windows app on this same (XP Pro) machine, and from
both Windows & asp.net on another machine?

Thanks.

Frank
-----Original Message-----
Frank wrote:
Ray - thanks for responding - but, no, setting the
SmtpServer property to either "localhost" or another
available (working) smtp server does not change anything for better or worse.

I also made the ASPNET account (aspnet_wp, right?) an
administrator. I've had some trouble before from folders that didn't have web sharing turned on, so I did that for the mailroot and its subfolders - no change.

The message, "Could not access 'CDO.Message' object", and the fact that mail works fine from Windows Forms apps on the same machine, makes it sound like it's an ASP.NET or IIS issue.

There were also some Windows 2003 Server questions today on the same topic, but none of the responses shed any
light on this for me.

Do you have any more suggestions?

Thanks. Frank

-----Original Message-----
Hi Frank,

Does setting the SmtpServer property to "localhost" (or

whatever your SMTP
server is) fix it? If not, try checking the ASPNET
account's permissions on
the mailroot's folders.
--
Ray Dixon - Microsoft MVP
ra*@NOSPAM.greeble.com
(remove NOSPAM. from my e-mail address for a direct


reply)

"Frank" <ft*****@nc.rr.com> wrote in message
news:00****************************@phx.gbl.. .

Straightforward VB.NET 2002 code that works form both
Windows and ASP.NET apps on a Windows 2000 machine,

andworks in the Windows app on a newly installed XP

machine,
but fails in the ASP.NET code on XP. The unhandled
exception is "COMException: The 'SendUsing'

configuration
value is invalid." If I handle the exception, the
exception's Message is "Could not access 'CDO.Message'
object."

The essence of the code is:
Imports System.Web.Mail
...
Dim m as New MailMessage()
m.From = ...set all properties
smtpmail.send(m)

There are no attachments, but adding attachments to anyof the 4 versions of the app does not change the

results.
The smtp server is the local machine in all cases, and
changing that does not change the results.

I'd welcome any ideas.

Thanks.
.

Could you use a debugger to trace into

the "InnerException" field of theexception raised in send?

In fact, the dotnet mail function just will throw the "Could not access'CDO.Message' object.", but the actual problem is the one in the"InnerException". You may need to find the "InnerException" of the"InnerException" until no deeper "InnerException".

You can also change the code to make a loop to print the
"InnerException" until the "InnerException" to be null.

--
Jacky Kwok
ja***@alumni.cuhk.edu.hk
ja***@compose.com.hk

.

Nov 17 '05 #4

P: n/a
The "Unable to relay" message would come if you used a server other than the
local machine, and that SMTP server disallows relaying. If you leave off the
SMTPServer property altogether, SMTPMail will use the local machine's SMTP
server by default. That's one way to make sure that the local machine's SMTP
server is used, and you shouldn't have any relaying issues in that case.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Complex things are made up of
lots of simple things.

"Frank" <ft*****@nc.rr.com> wrote in message
news:09****************************@phx.gbl...
Jacky -

There is only one level of InnerException, "The server
rejected one or more recipient addresses. The server
response was: 550 5.7.1 Unable to relay for
ft*****@nc.rr.com".

So my problem still is, why would the same code work from
a Windows app on this same (XP Pro) machine, and from
both Windows & asp.net on another machine?

Thanks.

Frank
-----Original Message-----
Frank wrote:
Ray - thanks for responding - but, no, setting the
SmtpServer property to either "localhost" or another
available (working) smtp server does not change anything for better or worse.

I also made the ASPNET account (aspnet_wp, right?) an
administrator. I've had some trouble before from folders that didn't have web sharing turned on, so I did that for the mailroot and its subfolders - no change.

The message, "Could not access 'CDO.Message' object", and the fact that mail works fine from Windows Forms apps on the same machine, makes it sound like it's an ASP.NET or IIS issue.

There were also some Windows 2003 Server questions today on the same topic, but none of the responses shed any
light on this for me.

Do you have any more suggestions?

Thanks. Frank


-----Original Message-----
Hi Frank,

Does setting the SmtpServer property to "localhost" (or
whatever your SMTP

server is) fix it? If not, try checking the ASPNET

account's permissions on

the mailroot's folders.
--
Ray Dixon - Microsoft MVP
ra*@NOSPAM.greeble.com
(remove NOSPAM. from my e-mail address for a direct

reply)
"Frank" <ft*****@nc.rr.com> wrote in message
news:00****************************@phx.gbl.. .

>Straightforward VB.NET 2002 code that works form both
>Windows and ASP.NET apps on a Windows 2000 machine, and>works in the Windows app on a newly installed XP

machine,

>but fails in the ASP.NET code on XP. The unhandled
>exception is "COMException: The 'SendUsing'

configuration

>value is invalid." If I handle the exception, the
>exception's Message is "Could not access 'CDO.Message'
>object."
>
>The essence of the code is:
>Imports System.Web.Mail
>...
>Dim m as New MailMessage()
>m.From = ...set all properties
>smtpmail.send(m)
>
>There are no attachments, but adding attachments to any>of the 4 versions of the app does not change the

results.

>The smtp server is the local machine in all cases, and
>changing that does not change the results.
>
>I'd welcome any ideas.
>
>Thanks.
.

Could you use a debugger to trace into

the "InnerException" field of the
exception raised in send?

In fact, the dotnet mail function just will throw

the "Could not access
'CDO.Message' object.", but the actual problem is the

one in the
"InnerException". You may need to find

the "InnerException" of the
"InnerException" until no deeper "InnerException".

You can also change the code to make a loop to print the
"InnerException" until the "InnerException" to be null.

--
Jacky Kwok
ja***@alumni.cuhk.edu.hk
ja***@compose.com.hk

.

Nov 17 '05 #5

P: n/a
This solution came from Microsoft's Exchange group:

In earlier versions of Windows 2000, access to the local
SMTP server was automatically open to any computer that
tried to use it. In code, you did not need to specify
the SMTP server, and it would default to the local
machine and work.

Later in Win 2k, and in XP, 2003, etc, this was
tightened - you have to specifically give access to the
smtp server. In IIS, you go to the Properties of the
default smtp server, Access, Relay, and Add the local
computer IP address or name to the list.

And, in code, you must specify the smtpserver property.

It works, but re-opens the possibility that some
unauthorized outsider might use your machine to relay
messages.

Frank

-----Original Message-----
Ray - thanks for responding - but, no, setting the
SmtpServer property to either "localhost" or another
available (working) smtp server does not change anything
for better or worse.

I also made the ASPNET account (aspnet_wp, right?) an
administrator. I've had some trouble before from foldersthat didn't have web sharing turned on, so I did that forthe mailroot and its subfolders - no change.

The message, "Could not access 'CDO.Message' object", andthe fact that mail works fine from Windows Forms apps on
the same machine, makes it sound like it's an ASP.NET or
IIS issue.

There were also some Windows 2003 Server questions today
on the same topic, but none of the responses shed any
light on this for me.

Do you have any more suggestions?

Thanks. Frank


-----Original Message-----
Hi Frank,

Does setting the SmtpServer property to "localhost" (or

whatever your SMTP
server is) fix it? If not, try checking the ASPNET

account's permissions on
the mailroot's folders.
--
Ray Dixon - Microsoft MVP
ra*@NOSPAM.greeble.com
(remove NOSPAM. from my e-mail address for a direct

reply)


"Frank" <ft*****@nc.rr.com> wrote in message
news:00****************************@phx.gbl...
Straightforward VB.NET 2002 code that works form both
Windows and ASP.NET apps on a Windows 2000 machine, and works in the Windows app on a newly installed XPmachine, but fails in the ASP.NET code on XP. The unhandled
exception is "COMException: The 'SendUsing'configuration value is invalid." If I handle the exception, the
exception's Message is "Could not access 'CDO.Message'
object."

The essence of the code is:
Imports System.Web.Mail
...
Dim m as New MailMessage()
m.From = ...set all properties
smtpmail.send(m)

There are no attachments, but adding attachments to any of the 4 versions of the app does not change theresults. The smtp server is the local machine in all cases, and
changing that does not change the results.

I'd welcome any ideas.

Thanks.

.

.

Nov 17 '05 #6

P: n/a
Hello Frank,

Thanks for sharing it with us. I believe it could help web email programmers much in this group.

Best regards,
Yanhong Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
!Content-Class: urn:content-classes:message
!From: "Frank" <ft*****@nc.rr.com>
!Sender: "Frank" <ft*****@nc.rr.com>
!References: <00****************************@phx.gbl> <uq**************@TK2MSFTNGP10.phx.gbl>
<0a****************************@phx.gbl>
!Subject: Re: ASP.NET MailMessage in XP fails
!Date: Wed, 30 Jul 2003 11:20:32 -0700
!Lines: 110
!Message-ID: <09****************************@phx.gbl>
!MIME-Version: 1.0
!Content-Type: text/plain;
! charset="iso-8859-1"
!Content-Transfer-Encoding: 7bit
!X-Newsreader: Microsoft CDO for Windows 2000
!X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
!Thread-Index: AcNWx0NEjufaGK23R/aVA5UkFC7z0Q==
!Newsgroups: microsoft.public.dotnet.framework.aspnet
!Path: cpmsftngxa06.phx.gbl
!Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:163483
!NNTP-Posting-Host: TK2MSFTNGXA06 10.40.1.53
!X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
!
!This solution came from Microsoft's Exchange group:
!
!In earlier versions of Windows 2000, access to the local
!SMTP server was automatically open to any computer that
!tried to use it. In code, you did not need to specify
!the SMTP server, and it would default to the local
!machine and work.
!
!Later in Win 2k, and in XP, 2003, etc, this was
!tightened - you have to specifically give access to the
!smtp server. In IIS, you go to the Properties of the
!default smtp server, Access, Relay, and Add the local
!computer IP address or name to the list.
!
!And, in code, you must specify the smtpserver property.
!
!It works, but re-opens the possibility that some
!unauthorized outsider might use your machine to relay
!messages.
!
!Frank
!
!
!
!
!>-----Original Message-----
!>Ray - thanks for responding - but, no, setting the
!>SmtpServer property to either "localhost" or another
!>available (working) smtp server does not change anything
!>for better or worse.
!>
!>I also made the ASPNET account (aspnet_wp, right?) an
!>administrator. I've had some trouble before from
!folders
!>that didn't have web sharing turned on, so I did that
!for
!>the mailroot and its subfolders - no change.
!>
!>The message, "Could not access 'CDO.Message' object",
!and
!>the fact that mail works fine from Windows Forms apps on
!>the same machine, makes it sound like it's an ASP.NET or
!>IIS issue.
!>
!>There were also some Windows 2003 Server questions today
!>on the same topic, but none of the responses shed any
!>light on this for me.
!>
!>Do you have any more suggestions?
!>
!>Thanks. Frank
!>
!>
!>
!>
!>
!>>-----Original Message-----
!>>Hi Frank,
!>>
!>>Does setting the SmtpServer property to "localhost" (or
!>whatever your SMTP
!>>server is) fix it? If not, try checking the ASPNET
!>account's permissions on
!>>the mailroot's folders.
!>>
!>>
!>>--
!>>Ray Dixon - Microsoft MVP
!>>ra*@NOSPAM.greeble.com
!>>(remove NOSPAM. from my e-mail address for a direct
!>reply)
!>>
!>>
!>>"Frank" <ft*****@nc.rr.com> wrote in message
!>>news:00****************************@phx.gbl...
!>>> Straightforward VB.NET 2002 code that works form both
!>>> Windows and ASP.NET apps on a Windows 2000 machine,
!and
!>>> works in the Windows app on a newly installed XP
!>machine,
!>>> but fails in the ASP.NET code on XP. The unhandled
!>>> exception is "COMException: The 'SendUsing'
!>configuration
!>>> value is invalid." If I handle the exception, the
!>>> exception's Message is "Could not access 'CDO.Message'
!>>> object."
!>>>
!>>> The essence of the code is:
!>>> Imports System.Web.Mail
!>>> ...
!>>> Dim m as New MailMessage()
!>>> m.From = ...set all properties
!>>> smtpmail.send(m)
!>>>
!>>> There are no attachments, but adding attachments to
!any
!>>> of the 4 versions of the app does not change the
!>results.
!>>> The smtp server is the local machine in all cases, and
!>>> changing that does not change the results.
!>>>
!>>> I'd welcome any ideas.
!>>>
!>>> Thanks.
!>>
!>>
!>>.
!>>
!>.
!>
!
Nov 17 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.