title: Classic ASP HTML email form
body: <p>I'm using Gmails external mail server to send product inquiry forms from my website. The form itself sends fine, however the email that's dispatched doesn't include the product information included in my form. </p>
  
  <p>My simplified form looks like this:</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt;
  &lt;head&gt;
  &lt;title&gt;Free Products&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;form id="data" name="data" method="post" action="email.asp"&gt;
    &lt;div class="myform"&gt;
    &lt;input type="hidden" name="PCode" value="Free_Products" /&gt;
    &lt;input type="hidden" name="CCode" value="CampaignCode" /&gt;
    &lt;input type="hidden" name="MCode" value="CampaignName" /&gt;
    &lt;input type="hidden" name="Action" value="Add" /&gt;
    &lt;input type="hidden" name="Qty" value="1" /&gt;
    &lt;input type="hidden" name="BackURL" value="www.myurl.com" /&gt;
    &lt;ul id="cat_box"&gt;
    &lt;label for="ProductCode1"&gt;Add quantity:&lt;/label&gt;
    &lt;input id="ProductCode1" type="text" name="ProductCode1" size="8" maxlength="4" class="qtytext" title="test title"&gt;
    &lt;select id="ProductCode2" name="ProductCode2" &gt;
      &lt;option value="0"&gt;0&lt;/option&gt;
      &lt;option value="1"&gt;1&lt;/option&gt;
      &lt;option value="2"&gt;2&lt;/option&gt;
    &lt;/select&gt;
    &lt;/form&gt;
  &lt;div id="dialog" title="Thank you for your order"&gt;
    &lt;p&gt;Thank you for your order.&lt;/p&gt;
    This order will be dispatched within 14 days.
    &lt;/p&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>And my asp email script looks like this:</p>
  
  <pre><code>&lt;%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
  &lt;title&gt;My Form&lt;/title&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;%
  
  ' declare variables
  Dim ProductCode1
  Dim ProductCode2
  
  ' get posted data into variables
  ProductCode1 = Trim(Request.Form("ProductCode1"))
  ProductCode2 = Trim(Request.Form("ProductCode2"))
  
  ' validation
  Dim validationOK
  validationOK=true
  If (Trim(ProductCode1)="") Then validationOK=false
  If (Trim(ProductCode2)="") Then validationOK=false
  If (validationOK=false) Then Response.Redirect("error.html?" &amp; EmailFrom)
  
  ' prepare email body text
  Dim Body
  Body = Body &amp; "ProductCode1: " &amp; ProductCode1 &amp; VbCrLf
  Body = Body &amp; "ProductCode2: " &amp; ProductCode2 &amp; VbCrLf
  
  Const cdoSendUsingPickup = 1 'Send message using the local SMTP service pickup directory. 
  Const cdoSendUsingPort = 2 'Send the message using the network (SMTP over the network). 
  
  Const cdoAnonymous = 0 'Do not authenticate
  Const cdoBasic = 1 'basic (clear-text) authentication
  Const cdoNTLM = 2 'NTLM
  
  Set objMessage = CreateObject("CDO.Message") 
  objMessage.Subject = "Example CDO Message" 
  objMessage.From = """Me"" &lt;myAddress@gmail.com&gt;" 
  objMessage.To = "myAddress@gmail.com" 
  objMessage.TextBody = "This is some sample message text.." &amp; vbCRLF &amp; "It was sent using SMTP authentication and SSL."
  
  '==This section provides the configuration information for the remote SMTP server.
  
  objMessage.Configuration.Fields.Item _
  ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 
  
  'Name or IP of Remote SMTP Server
  objMessage.Configuration.Fields.Item _
  ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
  
  'Type of authentication, NONE, Basic (Base64 encoded), NTLM
  objMessage.Configuration.Fields.Item _
  ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic
  
  'Your UserID on the SMTP server
  objMessage.Configuration.Fields.Item _
  ("http://schemas.microsoft.com/cdo/configuration/sendusername") = "myAddress@gmail.com"
  
  'Your password on the SMTP server
  objMessage.Configuration.Fields.Item _
  ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "MyPassword"
  
  'Server port (typically 25)
  objMessage.Configuration.Fields.Item _
  ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465 
  
  'Use SSL for the connection (False or True)
  objMessage.Configuration.Fields.Item _
  ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
  
  'Connection Timeout in seconds (the maximum time CDO will try to establish a connection to the SMTP server)
  objMessage.Configuration.Fields.Item _
  ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
  
  objMessage.Configuration.Fields.Update
  
  '==End remote SMTP server configuration section==
  
  objMessage.Send
  %&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Any ideas what I'm missing? Why isn't my form talking to my asp script?</p>
  
  <p>Thanks</p>