Solved

CDO & ASP message variable question

Posted on 2009-04-13
7
628 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Firebug on Firefox 50 2 128
stop navigation from wrapping 7 77
The Best Website Creation Tools 14 53
Call a function within the ASP code 4 7
Envision that you are chipping away at another e-business site with a team of pundit developers and designers. Everything seems, by all accounts, to be going easily.
Any business that wants to seriously grow needs to keep the needs and desires of an international audience of their websites in mind. Making a website friendly to international users isn’t prohibitively expensive and can provide an incredible return…
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…

813 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

19 Experts available now in Live!

Get 1:1 Help Now