http://www.chrispearson.org/pages/programming/vbscript/Email/sendmail.asp
17h01
Thursday, 28. August 2008

SEND EMAIL

This page brings together much of the material discussed in ASP Email and the review of properties and methods in CDONTS NewMail.

The code is shown on the page, but only the relevent parts of it - Look at the page's source to place it in context - The full code of the ASP page that sends the email, processmail.asp, is provided on the page processmail_code.asp.

ASP Email - main article

HTML form to collect message parameters

Send yourself an email
 
 
email address
 
subject
Test email created on 28 .  August
 
from
testmail_Sender
 
body
Hello,
This message was created on the server
and transmitted to you at your own request.
   

The HTML code that submits the message parameters is:

<FORM ACTION="processmail.asp"
  METHOD="post"
  ENCTYPE="multipart/form-data"
  NAME="frmSendMail"
  ID="frmSendMail">
<TABLE WIDTH="100%"
  BORDER="0"
  CELLPADDING="4"
  CELLSPACING="0"
  BGCOLOR="#FFFFFF">
<TR>
  <TD WIDTH="100">
     <IMG SRC="../../../../images/40x40.gif"
       WIDTH="100"
      
HEIGHT="1">
  </TD>
  <TD>Send yourself an email</TD>
  <TD>&nbsp;</TD>
</TR>
<TR>
  <TD WIDTH="100">&nbsp;</TD>
  <TD>email address</TD>
  <TD>
     <INPUT NAME="txtTo" TYPE="text" ID="txtTo" SIZE="40"></TD>
</TR>
<TR>
  <TD>&nbsp;</TD>
  <TD>subject</TD>
  <TD>Test email created on
28 .&nbsp; August
   <INPUT NAME="txtSubject"
     TYPE="hidden"
     VALUE="Test email created on 28 .&nbsp; August ">
  </TD>
</TR>
<TR>
  <TD>&nbsp;</TD>
  <TD>from</TD>
  <TD>testmail_Sender
     <INPUT NAME="txtFrom"
       TYPE="hidden"
       ID="txtFrom"
       VALUE="testmail_Sender">
  </TD>
</TR>
<TR>
  <TD>&nbsp;</TD>
  <TD>body</TD>
  <TD>Hello,<BR>
    This message was created on the server<BR>
    and transmitted to you at your own request.
   <INPUT NAME="txtBody"
     TYPE="hidden"
     ID="txtBody"
     VALUE="Hello,
     This message was created on the server and
     transmitted to you at your own request.">
  </TD>
</TR>
<TR>
  <TD>&nbsp;</TD>
  <TD>&nbsp;</TD>
  <TD>
     <INPUT NAME="cmdSubmit"
       TYPE="submit"
       ID="cmdSubmit"
       VALUE="Send">
 
</TD>
</TR>
</TABLE>
</FORM>

Clicking on the Send button submits the form data to the active server page, processmail.asp. The code from processmail.asp is shown on processmail_code.asp.

xxx,xxx

copyright ©2000 - 2008 Chris Pearson