Professional Web Applications Themes

ASP.NET MailMessage in XP fails - ASP.NET General

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 ...

  1. #1

    Default 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.
    Frank Guest

  2. #2

    Default Re: ASP.NET MailMessage in XP fails

    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
    [email]rayNOSPAM.greeble.com[/email]
    (remove NOSPAM. from my e-mail address for a direct reply)


    "Frank" <ftoziernc.rr.com> wrote in message
    news:000601c355eb$b3d93d20$a401280aphx.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.

    Ray Dixon [MVP] Guest

  3. #3

    Default Re: ASP.NET MailMessage in XP fails

    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
    >rayNOSPAM.greeble.com
    >(remove NOSPAM. from my e-mail address for a direct
    reply)
    >
    >
    >"Frank" <ftoziernc.rr.com> wrote in message
    >news:000601c355eb$b3d93d20$a401280aphx.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.
    >
    >
    >.
    >
    Frank Guest

  4. #4

    Default Re: ASP.NET MailMessage in XP fails

    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
    [email]ftoziernc.rr.com[/email]".

    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
    >>>rayNOSPAM.greeble.com
    >>>(remove NOSPAM. from my e-mail address for a direct
    >>
    >> reply)
    >>
    >>>
    >>>"Frank" <ftoziernc.rr.com> wrote in message
    >>>news:000601c355eb$b3d93d20$a401280aphx.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
    >jackyalumni.cuhk.edu.hk
    >jackycompose.com.hk
    >
    >.
    >
    Frank Guest

  5. #5

    Default Re: ASP.NET MailMessage in XP fails

    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
    [url]http://www.takempis.com[/url]
    Complex things are made up of
    lots of simple things.

    "Frank" <ftoziernc.rr.com> wrote in message
    news:091f01c35693$814d8bb0$3501280aphx.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
    > [email]ftoziernc.rr.com[/email]".
    >
    > 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
    > >>>rayNOSPAM.greeble.com
    > >>>(remove NOSPAM. from my e-mail address for a direct
    > >>
    > >> reply)
    > >>
    > >>>
    > >>>"Frank" <ftoziernc.rr.com> wrote in message
    > >>>news:000601c355eb$b3d93d20$a401280aphx.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
    > >jackyalumni.cuhk.edu.hk
    > >jackycompose.com.hk
    > >
    > >.
    > >

    Kevin Spencer Guest

  6. #6

    Default Re: ASP.NET MailMessage in XP fails

    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
    >>rayNOSPAM.greeble.com
    >>(remove NOSPAM. from my e-mail address for a direct
    >reply)
    >>
    >>
    >>"Frank" <ftoziernc.rr.com> wrote in message
    >>news:000601c355eb$b3d93d20$a401280aphx.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.
    >>
    >>
    >>.
    >>
    >.
    >
    Frank Guest

  7. #7

    Default Re: ASP.NET MailMessage in XP fails

    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! - [url]www.microsoft.com/security[/url]
    This posting is provided "AS IS" with no warranties, and confers no rights.

    --------------------
    !Content-Class: urn:content-classes:message
    !From: "Frank" <ftoziernc.rr.com>
    !Sender: "Frank" <ftoziernc.rr.com>
    !References: <000601c355eb$b3d93d20$a401280aphx.gbl> <uqb#DegVDHA.2248TK2MSFTNGP10.phx.gbl>
    <0a0701c3563e$60cec2f0$7d02280aphx.gbl>
    !Subject: Re: ASP.NET MailMessage in XP fails
    !Date: Wed, 30 Jul 2003 11:20:32 -0700
    !Lines: 110
    !Message-ID: <09af01c356c7$4344d150$3501280aphx.gbl>
    !MIME-Version: 1.0
    !Content-Type: text/plain;
    ! cht="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
    !>>rayNOSPAM.greeble.com
    !>>(remove NOSPAM. from my e-mail address for a direct
    !>reply)
    !>>
    !>>
    !>>"Frank" <ftoziernc.rr.com> wrote in message
    !>>news:000601c355eb$b3d93d20$a401280aphx.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.
    !>>
    !>>
    !>>.
    !>>
    !>.
    !>
    !


    Yan-Hong Huang[MSFT] Guest

Similar Threads

  1. xml: img tag fails
    By maestudios in forum Macromedia Flash Data Integration
    Replies: 0
    Last Post: February 22nd, 12:46 AM
  2. why this fails ???
    By susanvoyce in forum Macromedia ColdFusion
    Replies: 3
    Last Post: May 6th, 01:47 PM
  3. CFMX 7 Fails
    By Old Tony in forum Macromedia ColdFusion
    Replies: 7
    Last Post: April 14th, 09:15 PM
  4. MailMessage Class
    By lostman in forum ASP.NET General
    Replies: 4
    Last Post: August 12th, 02:17 PM
  5. Replies: 1
    Last Post: July 31st, 06:45 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139