CDO.Message Error

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jacques Cooper

    #1

    CDO.Message Error

    Hello,

    We're developing a small SMTP client application. When
    we run the program we get the following error message:

    "could not access 'CDO.Message' object"

    We get the error message when we set the
    "SmtpMail.SmtpS erver" value. However, if
    we don't specify the server name we don't
    receive the email message either.

    // C# source code snippet.
    //

    MailMessage mm = new MailMessage();

    mm.From = "support@mycomp any.com";
    mm.To = "testgroup@myco mpany.com";
    mm.Cc = "";
    mm.Bcc = "";
    mm.Subject = "Test Subject";
    mm.Body = "Test Body";

    SmtpMail.SmtpSe rver = "mycompany.com" ;

    SmtpMail.Send(m m);

    // end of code snippet

    Any ideas about what could be causing the error message?

    TIA,
    Jacques


  • Jeffrey Tan[MSFT]

    #2
    RE: CDO.Message Error


    Hi Jacques,

    Does your application run in asp.net?
    The asp.net account may not have the enough privilege to access the network
    an create sockets.
    It DOES, however, have privileges to create a socket to the local machine
    (127.0.0.1 localhost).
    If you plan on using SmtpMail from an ASP.NET app, you MUST use your local
    SMTP Service, and not an external one.
    Alternatively, you could increase the privileges of the ASPNET account

    or does your application multithread?
    If it is multithreading, your mail code should run in the main form thread.

    Hope this helps,

    Best regards,
    Jeffrey Tan
    Microsoft Online Partner Support
    Get Secure! - www.microsoft.com/security
    This posting is provided "as is" with no warranties and confers no rights.

    --------------------
    | From: "Jacques Cooper" <jcooper@jcsoft ware.net>
    | Subject: CDO.Message Error
    | Date: Mon, 3 Nov 2003 21:34:38 -0800
    | Lines: 36
    | X-Priority: 3
    | X-MSMail-Priority: Normal
    | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
    | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
    | Message-ID: <OeT8UVpoDHA.27 32@TK2MSFTNGP11 .phx.gbl>
    | Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
    | NNTP-Posting-Host: omega.jcsoftwar e.net 66.15.15.165
    | Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!TK2 MSFTNGP11.phx.g bl
    | Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.langua ges.csharp:1965 11
    | X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.csharp
    |
    | Hello,
    |
    | We're developing a small SMTP client application. When
    | we run the program we get the following error message:
    |
    | "could not access 'CDO.Message' object"
    |
    | We get the error message when we set the
    | "SmtpMail.SmtpS erver" value. However, if
    | we don't specify the server name we don't
    | receive the email message either.
    |
    | // C# source code snippet.
    | //
    |
    | MailMessage mm = new MailMessage();
    |
    | mm.From = "support@mycomp any.com";
    | mm.To = "testgroup@myco mpany.com";
    | mm.Cc = "";
    | mm.Bcc = "";
    | mm.Subject = "Test Subject";
    | mm.Body = "Test Body";
    |
    | SmtpMail.SmtpSe rver = "mycompany.com" ;
    |
    | SmtpMail.Send(m m);
    |
    | // end of code snippet
    |
    | Any ideas about what could be causing the error message?
    |
    | TIA,
    | Jacques
    |
    |
    |

    Comment

    • Jacques Cooper

      #3
      Re: CDO.Message Error

      Hello Jeffrey,

      Thank you for responding to my posting. However, we are not using ASP.NET.
      This is a stand-alone C# application.

      Any ideas?

      Thanks,
      Jacques


      Comment

      • Jeffrey Tan[MSFT]

        #4
        Re: CDO.Message Error


        Hi Jacques,

        Thanks for your feedback.
        Is your smtp server on your machine or on remote machine?
        I think you can try to setup a smtp server on your machine. In your
        application, if you do not specify the smtpserver, the .Net will search the
        smtp service on your machine.
        If your application can send the email through your machine's smtp service,
        I think you should check whether your remote smtp server support this
        feature.
        Also, you can check the permission of C:\Inetpub\mail root.

        Actually, there are a lot of possible reason for this error message. The
        link below contains a lot of discussion about this error, you can check it:


        Hope this helps,

        Best regards,
        Jeffrey Tan
        Microsoft Online Partner Support
        Get Secure! - www.microsoft.com/security
        This posting is provided "as is" with no warranties and confers no rights.

        --------------------
        | From: "Jacques Cooper" <jcooper@jcsoft ware.net>
        | References: <OeT8UVpoDHA.27 32@TK2MSFTNGP11 .phx.gbl>
        <uDw#QJsoDHA.18 04@cpmsftngxa06 .phx.gbl>
        | Subject: Re: CDO.Message Error
        | Date: Tue, 4 Nov 2003 06:29:48 -0800
        | Lines: 11
        | X-Priority: 3
        | X-MSMail-Priority: Normal
        | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
        | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
        | Message-ID: <OaCCYAuoDHA.17 40@TK2MSFTNGP12 .phx.gbl>
        | Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
        | NNTP-Posting-Host: omega.jcsoftwar e.net 66.15.15.165
        | Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!TK2 MSFTNGP12.phx.g bl
        | Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.langua ges.csharp:1965 93
        | X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.csharp
        |
        | Hello Jeffrey,
        |
        | Thank you for responding to my posting. However, we are not using ASP.NET.
        | This is a stand-alone C# application.
        |
        | Any ideas?
        |
        | Thanks,
        | Jacques
        |
        |
        |

        Comment

        • Gary van der Merwe

          #5
          Re: CDO.Message Error

          Try putting a try catch round your code, Then print Exception.ToStr ing()
          With the SMTP exceptions, the message allways says "could not access
          'CDO.Message' object", but if you do a Exception.ToStr ing(), it gives you
          more detail


          Gary
          "Jacques Cooper" <jcooper@jcsoft ware.net> wrote in message
          news:OeT8UVpoDH A.2732@TK2MSFTN GP11.phx.gbl...[color=blue]
          > Hello,
          >
          > We're developing a small SMTP client application. When
          > we run the program we get the following error message:
          >
          > "could not access 'CDO.Message' object"
          >
          > We get the error message when we set the
          > "SmtpMail.SmtpS erver" value. However, if
          > we don't specify the server name we don't
          > receive the email message either.
          >
          > // C# source code snippet.
          > //
          >
          > MailMessage mm = new MailMessage();
          >
          > mm.From = "support@mycomp any.com";
          > mm.To = "testgroup@myco mpany.com";
          > mm.Cc = "";
          > mm.Bcc = "";
          > mm.Subject = "Test Subject";
          > mm.Body = "Test Body";
          >
          > SmtpMail.SmtpSe rver = "mycompany.com" ;
          >
          > SmtpMail.Send(m m);
          >
          > // end of code snippet
          >
          > Any ideas about what could be causing the error message?
          >
          > TIA,
          > Jacques
          >
          >[/color]


          Comment

          Working...