Solved

CDO & ASP message variable question

Posted on 2009-04-13
7
622 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
Comment Utility
Add the name and phone to the email body.
0
 

Author Comment

by:derrickonline
Comment Utility
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
Comment Utility
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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 

Author Comment

by:derrickonline
Comment Utility
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
Comment Utility
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
Comment Utility
Ha ha ok thats why I was so confused!
0
 

Author Closing Comment

by:derrickonline
Comment Utility
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
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:
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

771 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

12 Experts available now in Live!

Get 1:1 Help Now