?
Solved

CDO & ASP message variable question

Posted on 2009-04-13
7
Medium Priority
?
636 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 1500 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
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 

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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
Originally, this post was published on Monitis Blog, you can check it here . It goes without saying that technology has transformed society and the very nature of how we live, work, and communicate in ways that would’ve been incomprehensible 5 ye…
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…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

801 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