kevinbradshaw
06-18-2006, 03:36 PM
Hi everyone.
i'm trying to create a form that sends info with CDO email using ASP pages. the form works and looks like i want it to, the ASP processing page seems to work, sort of. the only think i can't figure out is how to get the info in the form fields to show up in the email that i receive. the only thing that i can put in the email body is text. how do i get the form fields into the email?
This is the code from the form page:
<%@ LANGUAGE="VBScript" %>
<% '***************************************************************************
'* ASP Football Pool *
'* *
'* This is a simple form to request a new userid *
'***************************************************************************
subTitle = "New User Request" %>
<% Response.Buffer = true %>
<!-- #include file="common.asp" -->
<!-- #include file="header.asp" -->
<html>
<head>
</head>
<body>
<form style="text-align: center" onsubmit="return FrontPage_Form1_Validator(this)" language="JavaScript" method="POST" action="new_user_process.asp" name="FrontPage_Form1">
<div align="left">
<table class="main" cellpadding="0" cellspacing="0">
<tr>
<th align="left">
<p align="center">New User Request</th>
</tr>
<tr><td>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="right">
<p align="left"><strong>Name:</strong></td>
<td>
<p align="center"> <!--webbot bot="Validation" S-Display-Name="name" B-Value-Required="TRUE" I-Minimum-Length="1" --><input name="name" value="" size="20" />
</td>
</tr>
<tr>
<td align="right">
<p align="left"><strong>Email</strong> <strong>Address:</strong>:</td>
<td> <!--webbot bot="Validation" S-Display-Name="email_address" B-Value-Required="TRUE" I-Minimum-Length="1" --><input name="email_address" value="" size="20" /></td>
</tr>
<tr>
<td align="right">
<p align="left"><strong>Username:</strong></td>
<td>
<p align="center"> <!--webbot bot="Validation" S-Display-Name="username" B-Value-Required="TRUE" I-Minimum-Length="1" --><input name="username" value="" size="20" /></td>
</tr>
</table>
<p align="center" style="margin-top: 0; margin-bottom: 0"> </p>
<p align="center" style="margin-top: 0; margin-bottom: 0">This part is <b>not</b>
automatic. </p>
<p align="center" style="margin-top: 0; margin-bottom: 0">I will set up your username
and</p>
<p align="center" style="margin-top: 0; margin-bottom: 0">you'll receive an
email when </p>
<p align="center" style="margin-top: 0; margin-bottom: 0">it's complete.</p>
<p align="center" style="margin-top: 0; margin-bottom: 0"> </p>
</td></tr>
</table>
</div>
<p style="margin-top: 0; margin-bottom: 0"> </p>
<p style="margin-top: 0; margin-bottom: 0">
<input type="submit" value="Submit" name="B1" class="button" onclick=sendEmail()>
<input type="reset" value="Reset" name="B2" class="button"></p>
</form>
</body>
</html>
<!-- #include file="footer.asp" -->
this is the code from the process/redirect page: (it's the msgBody part that i can't figure out)
<% '***************************************************************************
'* ASP Football Pool *
'* *
'* This is a simple form to request a new userid *
'***************************************************************************
subTitle = "New User Request" %>
<% Response.Buffer = true %>
<!-- #include file="common.asp" -->
<!-- #include file="header.asp" -->
<HTML>
<HEAD>
<TITLE>Thank You</TITLE>
<META HTTP-EQUIV="Refresh" CONTENT="5; URL=http://www.nicole-and-kevin.com/football">
</HEAD>
<BODY>
<%
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 = "New Football Pool User Request"
objMessage.From = "footballpool@kevinbradshaw.com"
objMessage.To = "newfootballuser@kevinbradshaw.com"
msgBody = "New Football Pool User Request:"
msgBody = msgBody & chr(13)
msgBody = msgBody & chr(13)
msgBody = msgBody & "Name:" & chr(9) & chr(9) & chr(9) & "new_user.form.name" & chr(13)
msgBody = msgBody & "Email Address:" & chr(9) & "document.form.name" & chr(13)
msgBody = msgBody & "User ID:" & chr(9) & chr(9) & "document.form.name" & chr(13)
objMessage.textBody = msgBody
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
'Name or IP of Remote SMTP Server
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "217.160.226.98"
'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") = "m40465110-3"
'Your password on the SMTP server
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "KKbradshaw79"
'Server port (typically 25)
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
'Use SSL for the connection (False or True)
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
'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
objMessage.Send
%>
<p>
<p align="center" style="margin-top: 0; margin-bottom: 0"><b><font style="font-size: 46pt">Thank You</font></b></p>
<p align="center" style="margin-top: 0; margin-bottom: 0"><font size="6"><b> Your request has
been sent.</b></font></p>
<p align="center" style="margin-top: 0; margin-bottom: 0"><font size="6"><b>You
will receive an email when your</b></font></p>
<p align="center" style="margin-top: 0; margin-bottom: 0"><font size="6"><b>
username has been completed.</b></font></p>
<p>
<p align="center">
Click <a href="../football">here</a> if you are not automatically redirected
after a few seconds.</h3>
</BODY>
</HTML>
<!-- #include file="footer.asp" -->
i'm trying to create a form that sends info with CDO email using ASP pages. the form works and looks like i want it to, the ASP processing page seems to work, sort of. the only think i can't figure out is how to get the info in the form fields to show up in the email that i receive. the only thing that i can put in the email body is text. how do i get the form fields into the email?
This is the code from the form page:
<%@ LANGUAGE="VBScript" %>
<% '***************************************************************************
'* ASP Football Pool *
'* *
'* This is a simple form to request a new userid *
'***************************************************************************
subTitle = "New User Request" %>
<% Response.Buffer = true %>
<!-- #include file="common.asp" -->
<!-- #include file="header.asp" -->
<html>
<head>
</head>
<body>
<form style="text-align: center" onsubmit="return FrontPage_Form1_Validator(this)" language="JavaScript" method="POST" action="new_user_process.asp" name="FrontPage_Form1">
<div align="left">
<table class="main" cellpadding="0" cellspacing="0">
<tr>
<th align="left">
<p align="center">New User Request</th>
</tr>
<tr><td>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="right">
<p align="left"><strong>Name:</strong></td>
<td>
<p align="center"> <!--webbot bot="Validation" S-Display-Name="name" B-Value-Required="TRUE" I-Minimum-Length="1" --><input name="name" value="" size="20" />
</td>
</tr>
<tr>
<td align="right">
<p align="left"><strong>Email</strong> <strong>Address:</strong>:</td>
<td> <!--webbot bot="Validation" S-Display-Name="email_address" B-Value-Required="TRUE" I-Minimum-Length="1" --><input name="email_address" value="" size="20" /></td>
</tr>
<tr>
<td align="right">
<p align="left"><strong>Username:</strong></td>
<td>
<p align="center"> <!--webbot bot="Validation" S-Display-Name="username" B-Value-Required="TRUE" I-Minimum-Length="1" --><input name="username" value="" size="20" /></td>
</tr>
</table>
<p align="center" style="margin-top: 0; margin-bottom: 0"> </p>
<p align="center" style="margin-top: 0; margin-bottom: 0">This part is <b>not</b>
automatic. </p>
<p align="center" style="margin-top: 0; margin-bottom: 0">I will set up your username
and</p>
<p align="center" style="margin-top: 0; margin-bottom: 0">you'll receive an
email when </p>
<p align="center" style="margin-top: 0; margin-bottom: 0">it's complete.</p>
<p align="center" style="margin-top: 0; margin-bottom: 0"> </p>
</td></tr>
</table>
</div>
<p style="margin-top: 0; margin-bottom: 0"> </p>
<p style="margin-top: 0; margin-bottom: 0">
<input type="submit" value="Submit" name="B1" class="button" onclick=sendEmail()>
<input type="reset" value="Reset" name="B2" class="button"></p>
</form>
</body>
</html>
<!-- #include file="footer.asp" -->
this is the code from the process/redirect page: (it's the msgBody part that i can't figure out)
<% '***************************************************************************
'* ASP Football Pool *
'* *
'* This is a simple form to request a new userid *
'***************************************************************************
subTitle = "New User Request" %>
<% Response.Buffer = true %>
<!-- #include file="common.asp" -->
<!-- #include file="header.asp" -->
<HTML>
<HEAD>
<TITLE>Thank You</TITLE>
<META HTTP-EQUIV="Refresh" CONTENT="5; URL=http://www.nicole-and-kevin.com/football">
</HEAD>
<BODY>
<%
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 = "New Football Pool User Request"
objMessage.From = "footballpool@kevinbradshaw.com"
objMessage.To = "newfootballuser@kevinbradshaw.com"
msgBody = "New Football Pool User Request:"
msgBody = msgBody & chr(13)
msgBody = msgBody & chr(13)
msgBody = msgBody & "Name:" & chr(9) & chr(9) & chr(9) & "new_user.form.name" & chr(13)
msgBody = msgBody & "Email Address:" & chr(9) & "document.form.name" & chr(13)
msgBody = msgBody & "User ID:" & chr(9) & chr(9) & "document.form.name" & chr(13)
objMessage.textBody = msgBody
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
'Name or IP of Remote SMTP Server
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "217.160.226.98"
'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") = "m40465110-3"
'Your password on the SMTP server
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "KKbradshaw79"
'Server port (typically 25)
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
'Use SSL for the connection (False or True)
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
'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
objMessage.Send
%>
<p>
<p align="center" style="margin-top: 0; margin-bottom: 0"><b><font style="font-size: 46pt">Thank You</font></b></p>
<p align="center" style="margin-top: 0; margin-bottom: 0"><font size="6"><b> Your request has
been sent.</b></font></p>
<p align="center" style="margin-top: 0; margin-bottom: 0"><font size="6"><b>You
will receive an email when your</b></font></p>
<p align="center" style="margin-top: 0; margin-bottom: 0"><font size="6"><b>
username has been completed.</b></font></p>
<p>
<p align="center">
Click <a href="../football">here</a> if you are not automatically redirected
after a few seconds.</h3>
</BODY>
</HTML>
<!-- #include file="footer.asp" -->