Results 1 to 7 of 7

Thread: [02/03] Could not access 'CDO.Message' object

  1. #1

    Thread Starter
    Fanatic Member vishalmarya's Avatar
    Join Date
    Feb 2001
    Location
    New Delhi , INDIA
    Posts
    858

    Resolved [02/03] Could not access 'CDO.Message' object

    i am using the following code to send an email from a asp.net (1.1 ) page

    err i am getting is ,

    The transport failed to connect to the server.

    if i use try catch block then
    ex.message returns "Could not access 'CDO.Message' object."


    VB Code:
    1. Dim mail As New Mail.MailMessage
    2.         Dim SmtpMail As Mail.SmtpMail
    3.  
    4.         mail.To = "[email protected]"
    5.         mail.From = "[email protected]"
    6.         mail.Subject = "this is a test email."
    7.         mail.Body = "mail body"
    8.         mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", 1) 'basic authentication
    9.         mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "sender") 'set your username here
    10.         mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "mypass") 'set your password here
    11.         mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", 587)
    12.         mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpusessl", True)
    13.  
    14.         SmtpMail.SmtpServer = "smtp.myserver.com"
    15.         SmtpMail.Send(mail)


    1. the error is generated when i run the aspx page on my dev machine ( win xp pro sp2 iis 5.1)

    2. but it works fine if i put the page on my smtp server ( "smtp.myserver.com" )

    3. what makes it complicated is , it also works in vs 2005 using net.mail namespace ( on the same machine of case 1 )

    somebody got to help me on this.

    Thanks.
    Last edited by vishalmarya; Jan 18th, 2007 at 04:04 AM. Reason: resolved
    Vishal Marya, MCP .net 3.5
    My Site
    http://www.vstoolsgallery.com/
    http://visualstudiogallery.msdn.micr...b-f87a909b9266





    Please indicate what version of vb you use.
    Please mark your thread resolved using the Thread Tools above.
    -----------------------------------------

  2. #2
    Frenzied Member axion_sa's Avatar
    Join Date
    Jan 2002
    Location
    Joburg, RSA
    Posts
    1,724

    Re: [02/03] Could not access 'CDO.Message' object

    The "Could not access 'CDO.Message' object." exception is usually a wrapper for a more descriptive exception - have a look at the exceptionInstance.InnerException property, or easier still - Console.WriteLine(exceptionInstance.ToString()), to get the real problem.

  3. #3

    Thread Starter
    Fanatic Member vishalmarya's Avatar
    Join Date
    Feb 2001
    Location
    New Delhi , INDIA
    Posts
    858

    Re: [02/03] Could not access 'CDO.Message' object

    that is what i got
    ----------

    System.Web.HttpException: Could not access 'CDO.Message' object. ---> 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.Inv...........
    Vishal Marya, MCP .net 3.5
    My Site
    http://www.vstoolsgallery.com/
    http://visualstudiogallery.msdn.micr...b-f87a909b9266





    Please indicate what version of vb you use.
    Please mark your thread resolved using the Thread Tools above.
    -----------------------------------------

  4. #4

    Thread Starter
    Fanatic Member vishalmarya's Avatar
    Join Date
    Feb 2001
    Location
    New Delhi , INDIA
    Posts
    858

    Re: [02/03] Could not access 'CDO.Message' object

    anybody trying
    Vishal Marya, MCP .net 3.5
    My Site
    http://www.vstoolsgallery.com/
    http://visualstudiogallery.msdn.micr...b-f87a909b9266





    Please indicate what version of vb you use.
    Please mark your thread resolved using the Thread Tools above.
    -----------------------------------------

  5. #5

    Thread Starter
    Fanatic Member vishalmarya's Avatar
    Join Date
    Feb 2001
    Location
    New Delhi , INDIA
    Posts
    858

    Resolved Re: [02/03] Could not access 'CDO.Message' object

    i was using the gmail smtp server. so i was supposed to use port 465 or 587.
    right ?

    after banging my head for so long , just came to my mind to use default port

    that is 25 , it worked

    but how come , it is working on port 587 in vs 2005 on the same machine
    that i cannot understand
    Vishal Marya, MCP .net 3.5
    My Site
    http://www.vstoolsgallery.com/
    http://visualstudiogallery.msdn.micr...b-f87a909b9266





    Please indicate what version of vb you use.
    Please mark your thread resolved using the Thread Tools above.
    -----------------------------------------

  6. #6
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: [02/03] Could not access 'CDO.Message' object

    Quite possibly may have been configured that way. Who configured your SMTP?

  7. #7

    Thread Starter
    Fanatic Member vishalmarya's Avatar
    Join Date
    Feb 2001
    Location
    New Delhi , INDIA
    Posts
    858

    Re: [02/03] Could not access 'CDO.Message' object

    Quote Originally Posted by mendhak
    Quite possibly may have been configured that way. Who configured your SMTP?

    i didn't get you.

    i am not using any smtp client.

    I am using vb.net /asp.net to directly connect to gmail smtp server and send mails.
    Vishal Marya, MCP .net 3.5
    My Site
    http://www.vstoolsgallery.com/
    http://visualstudiogallery.msdn.micr...b-f87a909b9266





    Please indicate what version of vb you use.
    Please mark your thread resolved using the Thread Tools above.
    -----------------------------------------

Posting Permissions

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



Click Here to Expand Forum to Full Width