Solved

CDO & ASP message variable question

Posted on 2009-04-13
7
631 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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 

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!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Full width video doesn't shrink on mobile- wordpress, divi 8 63
show form submit button based on jquery sum 5 44
Hide cell in a table 2 27
send email part1 9 23
FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
Color can increase conversions, create feelings of warmth or even incite people to get behind a cause. If you want your website to really impact site visitors, then it is vital to consider the impact color has on them.
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
The viewer will learn how to dynamically set the form action using jQuery.

808 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