Need help with email script

Discussion in 'Site Programming, Development and Design' started by winhostdream123, Mar 8, 2010.

  1. Hello:

    Just wondering if anyone can help me with a small problem. Although I know something about ASP programming, I don't really understand scripts for sending email. I've searched the internet for a script and nothing seems to work for me.

    Winhost has posted some sample code at this link:
    http://support.Winhost.com/KB/a617/how-to-send-mail-using-cdo.aspx

    I've pasted the code at the bottom with some modifications for my own purposes. I've created an email form using Flash MX. When I test it I get the following error message:

    CDO.Message.1 error '80040213'
    The transport failed to connect to the server.

    Anyway can anybody help me?

    I'm also wondering about the words that come after 'objMessage.' ('To', 'From', and 'Subject'). Are these some sort of variables which I can name myself? For example I want to add some code to accept form values which I named: form_name, form_phone, and form_message. Would this be the correct code?

    objMessage.Name = request.form("form_name")
    objMessage.Phone = request.form("form_phone")
    objMessage.Message = request.form("form_message")

    Here is the sample code from Winhost:

    <%
    set objMessage = createobject("cdo.message")
    set objConfig = createobject("cdo.configuration")
    Set Flds = objConfig.Fields

    Flds.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    Flds.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="mail.mydomain.com"

    ' ' Passing SMTP authentication
    Flds.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'basic (clear-text) authentication
    Flds.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") ="postmaster@mydomain.com"
    Flds.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") ="password"

    Flds.update
    Set objMessage.Configuration = objConfig
    objMessage.To = "net-impactzone@hotmail.com"
    objMessage.From = request.form("form_address")
    objMessage.Subject = "New Task"
    objMessage.fields.update
    objMessage.HTMLBody = "This is a test sent from CDO using smtp authentication."
    objMessage.Send
    %>

    If anybody can help me then I thank you kindly,

    Sincerely,

    Rob
     
    Last edited by a moderator: Oct 14, 2015
  2. Ray

    Ray

    mail.mydomain.com and postmaster@mydomain.com are merely examples. You will need to actually type your true email server name and the correct POP account email address.
     

Share This Page