problems using CDO winhost server

Discussion in 'Email' started by marconellino, Feb 2, 2011.

  1. Hi,
    i want to use a simple email form (asp) using cdo.
    I copied and applied my details on the page but there is an error.
    This is the code:
    set objMessage = createobject("cdo.message")
    set objConfig = createobject("cdo.configuration")
    Set Flds = objConfig.Fields

    Flds.Item("") = 2
    Flds.Item("") =""

    ' ' Passing SMTP authentication
    Flds.Item ("") = 1 'basic (clear-text) authentication
    Flds.Item ("") =""
    Flds.Item ("") ="mypassword..."

    Set objMessage.Configuration = objConfig
    objMessage.To = ""
    objMessage.From = ""
    objMessage.Subject = "New Task"
    objMessage.HTMLBody = "This is a test sent from CDO using smtp authentication."

    Of course i used my postamaster password (hidden now for security)

    The error is:
    CDO.Message.1 error '80040213'
    The transport failed to connect to the server.
    /send.asp, line 27

    Pls let me know
  2. Ray


    Were is this ASP script residing on? Has it been uploaded to our web server and are you able to send email through your Outlook using
  3. I am having the same issue.

    Using CDOSYS and an asp mailer that worked on my own servers.

    Now it appears that the form is sent but does not arrive and the re direct part fails. Error 500.

    This is the old code.

    <title>Information Request from Advanced Web Databases, Inc. Corporate Website</title>
    Dim fromEmail
    Dim toEmail
    Dim subject
    Dim smtpServer
    Dim redirectUrl

    fromEmail = Request.Form ("email")
    toEmail = ""
    subject = "Information Request from Advanced Web Databases, Inc. Corporate Website"
    smtpServer = ""
    redirectUrl = "thankyou.asp"

    For Field = 1 to Request.Form.Count - 1
    FieldName = Replace(Request.Form.Key(Field),"_"," ")
    FieldValue = Request.Form.Item(Field)
    Body = Body & FieldName & ": " & FieldValue & VbCrLf
    'Dimension variables
    Dim objCDOSYSCon
    'Create the e-mail server object
    Set objCDOSYSMail = Server.CreateObject("CDO.Message")
    Set objCDOSYSCon = Server.CreateObject ("CDO.Configuration")
    'Set and update fields properties
    With objCDOSYSCon
    'Outgoing SMTP server
    .Fields("") = smtpServer
    .Fields("") = 25
    'CDO Port
    .Fields("") = 2
    .Fields("") = 60
    End With
    'Update the CDOSYS Configuration
    Set objCDOSYSMail.Configuration = objCDOSYSCon
    'Set and update email properties
    With objCDOSYSMail
    '0=Low, 1=Normal, 2=High
    .Fields("urn:schemas:httpmail:importance").Value = 1
    'Who the e-mail is from
    .From = fromEmail 'Request.Form("email_address")
    'Who the e-mail is sent to
    .To = toEmail '""
    'Who the e-mail is CC'd to
    .Cc = fromEmail
    'The subject of the e-mail
    .Subject = subject 'Request.Form("email_subject")
    'Set the e-mail body format (HTMLBody=HTML TextBody=Plain)
    .TextBody = Body
    'Send the e-mail
    End With
    'Close the server mail object
    Set objCDOSYSMail = Nothing
    Set objCDOSYSCon = Nothing

    'Rederect after sending email
    Response.Redirect redirectUrl 'Request.Form("redirect_to")

    I know I need to add authentication and I was going to do that but was not sure where it would go ??
  4. Ray


    Last edited by a moderator: Oct 14, 2015
  5. Yes I did and have fixed it.

    Added dim username and dim password after dim redirecturl.

    The hard coded both of them below the redirect url.

Share This Page