title: Using submitter's email address for "from" in ASP Classic form
body: <p>We've inherited a site that uses ASP Classic and there's a typical contact form that, when submitted, sends an email to a forwarding email address, so that support can handle the request. How can we configure CDOSYSMail to use the customer's email address as the "From" address in the email that is sent to us once the form is submitted? </p>
  
  <p>The form works and properly sends an email to the forwarding email address, but we want the "From" field in the email to come from the Email field in the form.</p>
  
  <p>I tried pulling in the email address from the form with the following, but it's not working:</p>
  
  <pre><code>request.Form("ContactUs_Email")
  </code></pre>
  
  <p>Here's where the FROM field is called. </p>
  
  <pre><code>&lt;!--#include file="CDOSYSMail.asp"--&gt;
  &lt;%
  dim ContactEmailFrom,ContactEmailTo,ContactEmailCC,ContactEmailSubject,ContactEmailHTMLBody,ContactEmailTextBody,ContactEmailAttachment,ContactUs_FirstName,ContactUs_LastName
  ContactEmailFrom=request.Form("ContactUs_Email")
  ContactEmailTo="support@woofooandmoo.com"
  ContactEmailHTMLBody=request.form("dataString")
  ContactEmailSubject="WFO-Accessibility" &amp; " " &amp; "Test" &amp; " " &amp; request.Form("ContactUs_FirstName") &amp; " " &amp; request.Form("ContactUs_LastName") 
  </code></pre>
  
  <p>Here's the code from the separate contactform.asp file:</p>
  
  <pre><code>&lt;form name="FormAccessibility" method="post" action="UserPage_ePiphany2.aspx?include=ContactUs.inc" id="Form1" class="UserPageForm"&gt;
  &lt;div class="main-block"&gt;        
              &lt;div class="contact-us-one"&gt;        
              &lt;div class="container"&gt; 
               &lt;div class="contact-us-one"&gt;   
                &lt;h3&gt;Contact Form&lt;/h3&gt; 
                  &lt;div class="container"&gt;
                        &lt;div class="row"&gt;
                       &lt;h4&gt; Personal Information&lt;/h4&gt;
                        &lt;/div&gt;
                        &lt;/div&gt;
                        &lt;/div&gt;    
                      &lt;div class="row"&gt;
                      &lt;div class="col-md-5 col-sm-6"&gt;
                              &lt;div class="contact-item"&gt;
                                  &lt;!-- Contact Form --&gt;
                                  &lt;div class="contact-form"&gt;
                                    &lt;div class="form-group"&gt;
                      &lt;input type="text" class="form-control validate[required,length[0,100]]" id="firstname" name="ContactUs_FirstName" placeholder="First Name (required)"&gt;
                  &lt;/div&gt;
  
                  &lt;div class="form-group"&gt;
                      &lt;input type="text" class="form-control" id="address1" name="ContactUs_Address1" placeholder="Address1"&gt;
                  &lt;/div&gt;
  
                  &lt;div class="form-group"&gt;
                      &lt;input type="text" class="form-control" id="city" name="ContactUs_City" placeholder="City"&gt;
                  &lt;/div&gt;
  
                  &lt;div class="form-group"&gt;
                      &lt;!-- &lt;input type="text" class="form-control" id="city" name="ContactUs_State" placeholder="State"&gt; --&gt;
                      &lt;select id="state" class="form-control" name="ContactUs_State"&gt;
                          &lt;option value="AL"&gt;Alabama&lt;/option&gt;
                          &lt;option value="AK"&gt;Alaska&lt;/option&gt;
                          &lt;option value="AZ"&gt;Arizona&lt;/option&gt;
                          &lt;option value="AR"&gt;Arkansas&lt;/option&gt;
                          &lt;option value="CA"&gt;California&lt;/option&gt;
                          &lt;option value="CO"&gt;Colorado&lt;/option&gt;
                          &lt;option value="CT"&gt;Connecticut&lt;/option&gt;
                          &lt;option value="DE"&gt;Delaware&lt;/option&gt;
                          &lt;option value="DC"&gt;District Of Columbia&lt;/option&gt;
                          &lt;option value="FL"&gt;Florida&lt;/option&gt;
                          &lt;option value="GA" selected="selected"&gt;Georgia&lt;/option&gt;
                          &lt;option value="HI"&gt;Hawaii&lt;/option&gt;
                          &lt;option value="ID"&gt;Idaho&lt;/option&gt;
                          &lt;option value="IL"&gt;Illinois&lt;/option&gt;
                          &lt;option value="IN"&gt;Indiana&lt;/option&gt;
                          &lt;option value="IA"&gt;Iowa&lt;/option&gt;
                          &lt;option value="KS"&gt;Kansas&lt;/option&gt;
                          &lt;option value="KY"&gt;Kentucky&lt;/option&gt;
                          &lt;option value="LA"&gt;Louisiana&lt;/option&gt;
                          &lt;option value="ME"&gt;Maine&lt;/option&gt;
                          &lt;option value="MD"&gt;Maryland&lt;/option&gt;
                          &lt;option value="MA"&gt;Massachusetts&lt;/option&gt;
                          &lt;option value="MI"&gt;Michigan&lt;/option&gt;
                          &lt;option value="MN"&gt;Minnesota&lt;/option&gt;
                          &lt;option value="MS"&gt;Mississippi&lt;/option&gt;
                          &lt;option value="MO"&gt;Missouri&lt;/option&gt;
                          &lt;option value="MT"&gt;Montana&lt;/option&gt;
                          &lt;option value="NE"&gt;Nebraska&lt;/option&gt;
                          &lt;option value="NV"&gt;Nevada&lt;/option&gt;
                          &lt;option value="NH"&gt;New Hampshire&lt;/option&gt;
                          &lt;option value="NJ"&gt;New Jersey&lt;/option&gt;
                          &lt;option value="NM"&gt;New Mexico&lt;/option&gt;
                          &lt;option value="NY"&gt;New York&lt;/option&gt;
                          &lt;option value="NC"&gt;North Carolina&lt;/option&gt;
                          &lt;option value="ND"&gt;North Dakota&lt;/option&gt;
                          &lt;option value="OH"&gt;Ohio&lt;/option&gt;
                          &lt;option value="OK"&gt;Oklahoma&lt;/option&gt;
                          &lt;option value="OR"&gt;Oregon&lt;/option&gt;
                          &lt;option value="PA"&gt;Pennsylvania&lt;/option&gt;
                          &lt;option value="RI"&gt;Rhode Island&lt;/option&gt;
                          &lt;option value="SC"&gt;South Carolina&lt;/option&gt;
                          &lt;option value="SD"&gt;South Dakota&lt;/option&gt;
                          &lt;option value="TN"&gt;Tennessee&lt;/option&gt;
                          &lt;option value="TX"&gt;Texas&lt;/option&gt;
                          &lt;option value="UT"&gt;Utah&lt;/option&gt;
                          &lt;option value="VT"&gt;Vermont&lt;/option&gt;
                          &lt;option value="VA"&gt;Virginia&lt;/option&gt;
                          &lt;option value="WA"&gt;Washington&lt;/option&gt;
                          &lt;option value="WV"&gt;West Virginia&lt;/option&gt;
                          &lt;option value="WI"&gt;Wisconsin&lt;/option&gt;
                          &lt;option value="WY"&gt;Wyoming&lt;/option&gt;
                      &lt;/select&gt;   
                  &lt;/div&gt;
  
                  &lt;div class="form-group"&gt;
                      &lt;input type="text" class="form-control" id="zip" name="ContactUs_Zip" placeholder="Zip"&gt;
                  &lt;/div&gt;               
  
                  &lt;/div&gt;
              &lt;/div&gt;
         &lt;/div&gt;
                         &lt;div class="col-md-5 col-sm-6"&gt;
                              &lt;div class="contact-item"&gt;
                                  &lt;!-- Contact Form --&gt;
                                  &lt;div class="contact-form"&gt;
                                   &lt;div class="form-group"&gt;
                                      &lt;input type="text" class="form-control" id="lastname" name="ContactUs_LastName" placeholder="Last Name"&gt;
                                  &lt;/div&gt;
                                   &lt;div class="form-group"&gt;
                                      &lt;input type="text" class="form-control" id="address2" name="ContactUs_Address2" placeholder="Address2"&gt;
                                  &lt;/div&gt;
  
                                  &lt;div class="form-group"&gt;
                                      &lt;input type="text" class="form-control validate[required,length[0,200]]" id="email" name="ContactUs_Email" placeholder="Email (required)"&gt;
                                  &lt;/div&gt;
  
                                  &lt;div class="form-group"&gt;
                                      &lt;input type="text" class="form-control" id="phone" name="ContactUs_Phone" placeholder="Phone"&gt;
                                  &lt;/div&gt;
  
                                  &lt;!-- Button --&gt;
                  &lt;button type="Submit" class="btn btn-red" id="subContactUs"&gt;Submit&lt;/button&gt;&amp;nbsp;
                  &lt;button type="Reset" class="btn btn-default"&gt;Reset&lt;/button&gt;
  
                                  &lt;/div&gt;
                              &lt;/div&gt;
                         &lt;/div&gt;
  
                        &lt;/div&gt; 
  
          &lt;/div&gt;
     &lt;/div&gt;
     &lt;/div&gt;
     &lt;/form&gt;
  
      &lt;script src="js/languages/jquery.validationEngine-en.js" type="text/javascript" charset="utf-8"&gt;
      &lt;/script&gt;
      &lt;script src="js/jquery.validationEngine.js" type="text/javascript" charset="utf-8"&gt;
      &lt;/script&gt;
      &lt;script&gt;
          $(document).ready(function () {
          // binds form submission and fields to the validation engine
          $("#FormAccessibility").validationEngine();
      });
  
      /**
      *
      * @param {jqObject} the field where the validation applies
      * @param {Array[String]} validation rules for this field
      * @param {int} rule index
      * @param {Map} form options
      * @return an error string if validation failed
      */
      function checkHELLO(field, rules, i, options) {
          if (field.val() != "Form1") {
              // this allows to use i18 for the error msgs
              return options.allrules.validate2fields.alertText;
          }
      }
  
      $(function () {
          $('#subContactUs').click(function (e) {
              e.preventDefault();
  
              //if invalid do nothing
              if (!$("#Form1").validationEngine('validate')) {
                  return false;
              }
  
              var chkChecked = "No";
              if ($('input[name=ContactUs_offerspromotions]').is(':checked')) {
                  chkChecked = "Yes";
              }
  
              var dataString = 'First Name: ' + $('input[name=ContactUs_FirstName]').val() + '&lt;br&gt;';
              dataString = dataString + 'Last Name: ' + $('input[name=ContactUs_LastName]').val() + '&lt;br&gt;';
              dataString = dataString + 'Address1: ' + $('input[name=ContactUs_Address1]').val() + '&lt;br&gt;';
              dataString = dataString + 'Address2: ' + $('input[name=ContactUs_Address2]').val() + '&lt;br&gt;'; 
              dataString = dataString + 'City: ' + $('input[name=ContactUs_City]').val() + '&lt;br&gt;';
              dataString = dataString + 'State: ' + $('select[name=ContactUs_State]').val() + '&lt;br&gt;';
              dataString = dataString + 'Email: ' + $('input[name=ContactUs_Email]').val() + '&lt;br&gt;';
              dataString = dataString + 'Zip: ' + $('input[name=ContactUs_Zip]').val() + '&lt;br&gt;';
              dataString = dataString + 'Phone: ' + $('input[name=ContactUs_Phone]').val() + '&lt;br&gt;';
  
            //alert(dataString);
              $.ajax({
                  type: "POST",
                  url: "inc/getDataAccessibility.asp",
                  data: { dataString: dataString },//dataString,
                  success: function (response) {
                      window.location.href = "http://www.woodstockoutlet.com/accessibility.asp";
                      /* alert(dataString); */
                  }
              });
              return false;
          })
      });
  &lt;/script&gt;
  </code></pre>