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

ASP.NET MailMessage in XP fails

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
6 2517
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Simran | last post by:
I need to set up an automated email system , which means users should not be able to respond back to the emails but at the same time, we need to track bounced emails. This is important as our...
4
by: Trond A. S. Andersen | last post by:
Hi, all! I'm trying to use the System.Web.Mail. "package" combinded with System.Web.Mail.SmtpMail in order to send MS Excel spreadsheets attached to mail messages. However, sending one single...
4
by: Mark Rae | last post by:
Hi, Can anyone please tell me if it's possible to pass a System.Web.Mail.MailMessage object to a ASP.NET Web Service? Maybe using XML Serialization / Deserialization? I've been asked to...
5
by: martin | last post by:
Hi, I have created a class that is totally seperate from my web application. However this class is used extensivly by the web application for stuff like data access. I wish to add a function to...
4
by: Aren Cambre | last post by:
Why does SmtpMail.Send throw an exception if the MailMessage's BodyFormat = MailFormat.Html? I've searched all over the place and cannot find a solution anywhere. I am running this on Windows XP...
3
by: Anthony Fine | last post by:
Hello All, I have a VB.Net app that needs to send mail. I have created a class for building my e-mail, but keep getting the error (Could not access 'CDO.Message' object.) when trying to send...
2
by: Jerryb | last post by:
I am using the Mailmessage class in my VB app, Everything works fine on my WinXP development box but when I run the app on Windows 2000 server it fails with "could not create cdo.message object"...
1
by: asnowfall | last post by:
I am creating MailMessage out of already existing email message. My existing message has few custom properties. I wan to add them to System.Net.Mail.MailMessage How to add custom properties? ...
2
by: =?Utf-8?B?Q2FwdGFpbiBEYXZlIQ==?= | last post by:
I wrote some code to send an email with two alternate views: 1) html 2) plain text All the html enabled email clients accept the html just fine and disregard the plain text version. However,...
1
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: 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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.