Solved

CDO & ASP message variable question

Posted on 2009-04-13
7
626 Views
Last Modified: 2012-05-06
I have a simple ASP form using CDO feedback form.  From what I gather my CDO variables are limited to:

 <%
 
      If Request.Form("btnSend").Count > 0 Then
     
         Set objMessage = CreateObject("CDO.Message")
         objMessage.Subject = Request.Form("subject")
         objMessage.Sender = Request.Form("From")
         objMessage.To = Request.Form("To")
         objMessage.TextBody = Request.Form("message")
         objMessage.Configuration.Fields.Item _
        ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
        objMessage.Configuration.Fields.Item _
        ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "192.168.98.25"
        objMessage.Configuration.Fields.Item _
        ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
        objMessage.Configuration.Fields.Update
        objMessage.Send
        Response.Redirect("Sent.html")
     End If
     %>


But how can I add a section for:

Name (not email, but name)
and
Phone

I've added the fields to my form, but how do I get CDO to add the information (i.e. name and phone) when it sends the message.

PS:  These fields (name and phone) aren't prepopulated.  The user would insert his/her name, and his/her phone number.  
<%

 

      If Request.Form("btnSend").Count > 0 Then

      

         Set objMessage = CreateObject("CDO.Message")

         objMessage.Subject = Request.Form("subject")

         objMessage.Sender = Request.Form("From")

         objMessage.To = Request.Form("To")

         objMessage.TextBody = Request.Form("message")

         objMessage.Configuration.Fields.Item _

        ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

        objMessage.Configuration.Fields.Item _

        ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "192.168.98.25"

        objMessage.Configuration.Fields.Item _

        ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25

        objMessage.Configuration.Fields.Update

        objMessage.Send

        Response.Redirect("Sent.html")

     End If

     %>

Open in new window

0
Comment
Question by:derrickonline
  • 4
  • 3
7 Comments
 
LVL 19

Expert Comment

by:daveamour
ID: 24131407
Add the name and phone to the email body.
0
 

Author Comment

by:derrickonline
ID: 24131429
Are you saying I can have multiple form fields called  "message"  in my form?  I'm not sure I'm following you, can you be more specifc.



0
 
LVL 19

Accepted Solution

by:
daveamour earned 500 total points
ID: 24131446
Well actually you can but that's not what I meant.
I meant something like:
objMessage.TextBody = "Name: " & Request.Form("name") & vbcrlf & "Phone: " & Request.Form("phone") & vbcrlf & vbcrlf & Request.Form("message")  
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

Author Comment

by:derrickonline
ID: 24131457
I think my orginal question was confusing.  Let me start again:


I've created a simple feedback from using ASP and CDO.  At the top of the page, I have the following data:

<%
 
      If Request.Form("btnSend").Count > 0 Then
     
         Set objMessage = CreateObject("CDO.Message")
         objMessage.Subject = Request.Form("subject")
         objMessage.Sender = Request.Form("From")
         objMessage.To = Request.Form("To")
         objMessage.TextBody = Request.Form("message")
         objMessage.Configuration.Fields.Item _
        ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
        objMessage.Configuration.Fields.Item _
        ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "192.168.98.25"
        objMessage.Configuration.Fields.Item _
        ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
        objMessage.Configuration.Fields.Update
        objMessage.Send
        Response.Redirect("Sent.html")
     End If
     %>


The rest of the ASP page is pretty much a simple HTML form.  Everything works properly.  BUT...I need to two additional fields to my form.

1.  NAME  

2.  PHONE


The code shown above seems to be the extend of the CDO variables available for sending a message.  So how can I somehow incorporate the form fields:  NAME and PHONE into the message since there really isn't anything CDO needs to do with that part except include it when it sends the message in the body.
0
 

Author Comment

by:derrickonline
ID: 24131466
Dave:  We must have posted our message at the same time.  Let me try your last comment out.  Give me a minute.
0
 
LVL 19

Expert Comment

by:daveamour
ID: 24131482
Ha ha ok thats why I was so confused!
0
 

Author Closing Comment

by:derrickonline
ID: 31569523
Dave...it worked like a charm.  These are probably some easy points for you!  But for me the issue was driving me crazy.  Thank you
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Read about why website design really matters in today's demanding market.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

912 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now