how can i change CDONTS values to CDOSYS?

Discussion in 'ASP General' started by beyaz, Mar 22, 2008.

  1. beyaz

    beyaz Guest

    I have the follwing code and cannot receive e mails sent from my contact
    form. Please advise how can i make it work with CDOSYS. Thank you.

    <%
    form_from = ""
    form_to = ""
    form_cc = Request.Form("mail_cc")
    form_bcc = Request.Form("mail_bcc")
    form_subject = "Reality Form Submission"
    form_importance = 1

    FOR x = 1 TO Request.Form.Count
    IF Request.Form.Key(x) = "mail_from" OR Request.Form.Key(x) = "mail_to" OR
    Request.Form.Key(x) = "mail_cc" OR Request.Form.Key(x) = "mail_bcc" OR
    Request.Form.Key(x) = "mail_subject" OR Request.Form.Key(x) =
    "mail_importance" OR Request.Form.Key(x) = "mail_redirect" OR
    Request.Form.Key(x) = "mail_send" OR Request.Form.Key(x) = "Submit" THEN
    form_variables = form_variables
    ELSE
    form_variables = form_variables & Request.Form.Key(x) & ": " & vbcrlf &
    Request.Form.Item(x) & vbcrlf & vbcrlf
    END IF
    NEXT

    DIM body_text
    body_text = vbcrlf & "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" & vbcrlf
    body_text = body_text & form_subject & vbcrlf
    body_text = body_text & "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" & vbcrlf
    & vbcrlf
    body_text = body_text & form_variables
    body_text = body_text & "Sent from: " & vbcrlf &
    Request.ServerVariables("HTTP_REFERER") & vbcrlf & vbcrlf
    body_text = body_text & "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" & vbcrlf


    <!--SET objMail = Server.CreateObject("CDONTS.NewMail")-->

    SET objMail = CreateObject("CDO.Message")

    <!--objMail.BodyFormat = 1-->
    <!--objMail.MailFormat = 1-->

    objMail.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/sendusing")=2

    objMail.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/smtpserver") _
    ="127.0.0.1"

    objMail.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") _
    =25
    objMail.Configuration.Fields.Update


    objMail.From = form_from
    objMail.To = form_to
    objMail.CC = form_cc
    objMail.BCC = form_bcc
    objMail.Subject = form_subject
    <!--objMail.Importance = form_importance-->
    objMail.TextBody = body_text
    objMail.Send
    SET objMail = NOTHING

    Response.Write("")
    %>
     
    beyaz, Mar 22, 2008
    #1
    1. Advertising

  2. "beyaz" <> wrote in message
    news:...
    > I have the follwing code and cannot receive e mails sent from my contact
    > form. Please advise how can i make it work with CDOSYS. Thank you.
    >
    > <%
    > form_from = ""
    > form_to = ""
    > form_cc = Request.Form("mail_cc")
    > form_bcc = Request.Form("mail_bcc")
    > form_subject = "Reality Form Submission"
    > form_importance = 1
    >
    > FOR x = 1 TO Request.Form.Count
    > IF Request.Form.Key(x) = "mail_from" OR Request.Form.Key(x) = "mail_to" OR
    > Request.Form.Key(x) = "mail_cc" OR Request.Form.Key(x) = "mail_bcc" OR
    > Request.Form.Key(x) = "mail_subject" OR Request.Form.Key(x) =
    > "mail_importance" OR Request.Form.Key(x) = "mail_redirect" OR
    > Request.Form.Key(x) = "mail_send" OR Request.Form.Key(x) = "Submit" THEN
    > form_variables = form_variables
    > ELSE
    > form_variables = form_variables & Request.Form.Key(x) & ": " & vbcrlf &
    > Request.Form.Item(x) & vbcrlf & vbcrlf
    > END IF
    > NEXT
    >
    > DIM body_text
    > body_text = vbcrlf & "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" & vbcrlf
    > body_text = body_text & form_subject & vbcrlf
    > body_text = body_text & "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" &

    vbcrlf
    > & vbcrlf
    > body_text = body_text & form_variables
    > body_text = body_text & "Sent from: " & vbcrlf &
    > Request.ServerVariables("HTTP_REFERER") & vbcrlf & vbcrlf
    > body_text = body_text & "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" &

    vbcrlf
    >
    >
    > <!--SET objMail = Server.CreateObject("CDONTS.NewMail")-->
    >
    > SET objMail = CreateObject("CDO.Message")
    >
    > <!--objMail.BodyFormat = 1-->
    > <!--objMail.MailFormat = 1-->
    >
    > objMail.Configuration.Fields.Item _
    > ("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
    >
    > objMail.Configuration.Fields.Item _
    > ("http://schemas.microsoft.com/cdo/configuration/smtpserver") _
    > ="127.0.0.1"
    >
    > objMail.Configuration.Fields.Item _
    > ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") _
    > =25
    > objMail.Configuration.Fields.Update
    >
    >
    > objMail.From = form_from
    > objMail.To = form_to
    > objMail.CC = form_cc
    > objMail.BCC = form_bcc
    > objMail.Subject = form_subject
    > <!--objMail.Importance = form_importance-->
    > objMail.TextBody = body_text
    > objMail.Send
    > SET objMail = NOTHING
    >
    > Response.Write("")
    > %>
    >



    The code looks a little weird but should work.

    What error are you getting?
    Are there errors in the event log on your system?
    Do the emails end up in the bad mail folder or just sit in the queue of your
    SMTP server?
    Have you checked that your SMTP allows relay from 127.0.0.1?



    --
    Anthony Jones - MVP ASP/ASP.NET
     
    Anthony Jones, Mar 22, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. BB
    Replies:
    2
    Views:
    125
  2. Todd M. Taylor

    Hotmail blocks emails sent w/ CDONTS/CDOSYS????

    Todd M. Taylor, Feb 2, 2004, in forum: ASP General
    Replies:
    0
    Views:
    227
    Todd M. Taylor
    Feb 2, 2004
  3. Paxton

    CDONTS to CDOSYS

    Paxton, Nov 11, 2004, in forum: ASP General
    Replies:
    1
    Views:
    105
    Ray Costanzo [MVP]
    Nov 12, 2004
  4. tshad

    CDOSYS AND CDONTS on W2K3 machine

    tshad, Jan 14, 2005, in forum: ASP General
    Replies:
    15
    Views:
    256
    tshad
    Jan 18, 2005
  5. Jed

    CDONTS or CDOSYS UTF-8 Email

    Jed, Nov 8, 2006, in forum: ASP General
    Replies:
    10
    Views:
    311
Loading...

Share This Page