CFF KB - Carrz-Fox-Fire Promotions Knowledge Base

CFF KB is all about 1 thing: The Sharing of Knowledge and the Power we gain from it.
  • Breadrumbs:
  • CDO.Message.1 error '80040213' The transport failed to connect to the server.

  • CFF Knowledge Base - Share With Facebook CFF Knowledge Base - Share on Twitter CFF Knowledge Base - Share on Reddit CFF Knowledge Base - Share on Digg It CFF Knowledge Base - Share on Stumble Upon It CFF Knowledge Base - Share on Delicious
    Share With Friends (Updated 6-8-2010)
  • Article ID:
    199
  • Date Created
    Wednesday, January 23, 2013
  • Last Updated
    Wednesday, January 23, 2013
  • This Article Has been Viewed
    9838 times
  • Short Desc
    Sometimes when setting up for CDOSYS, you make set the smtpusessl improperly. When this happens, your page generates the transport failed to connect to the server error.
  • Details
    When sending mail with CDOSYS, you have to make sure that your smtpusessl is setup correctly, if not, you will experience the following error.

     
    CDO.Message.1 error '80040213'
    The transport failed to connect to the server.
    /mail.asp, line 24
  • Recreate Issue
    To reproduce this issue:

    In your CDOSYS Mail, you have the following line.
    <%
    myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = true
    %>


    You can see where the end, we have true.
    If your server sends mail through SSL, then this is correct, however, if your mail server does not send through an SSL, than this is incorrect.
  • Resolve Issue
    To resolve this issue.

    With the above code, do one of the following Scenario's
    Scenario #1:
    Sending SSL, then change False to True
    Scenario #2:
    Not Sending SSL, then change True to False
    Scenario #3:
    If you do not have the line of code in your mail script, then you must add it in.

    You should then be able to send your mail.

    Full Working Mail Script

    <%
    Set myMail = CreateObject("CDO.Message")
    myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'Send the message using the network (SMTP over the network).
    myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="mail.domain.com"
    myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
    myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = false 'Use SSL for the connection (True or False)
    myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60

    ' If your server requires outgoing authentication uncomment the lines bleow and use a valid email address and password.
    myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'basic (clear-text) authentication
    myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") ="webmaster@domain.com"
    myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") ="********"

    myMail.Configuration.Fields.Update

    email = "name@somedomain.com"
    myMail.To = ""&email&""
    myMail.Subject = "KB Email Confirmation"
    myMail.From = "support@domain.com (KB)"

    myMail.HTMLBody = "This is line one<br />"
    myMail.HTMLBody = myMail.HTMLBody &"This is line 2<br />"
    myMail.HTMLBody = myMail.HTMLBody &"<div style=""text-align:center; vertical-align:top""><blockquote style=""color:#999999;""> KB is A %AEComapny Name Here©2000-"&Year(Now())&" Company</blockquote>"
    myMail.Send
    response.Write "Mail Sent Successfully!<br />Check your Inbox for: "&email

    Set myMail = Nothing
    %>