Return Home  
 

support


ASP E-mail how-to


Requirements

You will need the following information.

  • An HTML or text editor
  • an FTP client

What is it?
ASP E-mail is an active server component for sending e-mail messages using an external SMTP server in an ASP or VB environment.

Related Topics

Official Web Site (www.aspemail.com)

Step 1: Determine your platform.

UNIX: If your site is hosted on the UNIX platform, you will need to use a CGI script such as the formmail.pl script.  Please see http://www.nethere.com/support/webhosting/formmail.

Win 2000:  If your site is hosted on the 2000 platform, you will need to use the form provided by FrontPage which uses "web bots" or alternately ASP E-mail.  For ASP E-mail, please proceed to Step 2.

Step 2: Copy the HTML below and paste it into a new document in your editor.
*Note this is only a sample form! Your form may be much more complex. Simply use this as a starting point and customize your form to your needs.

<html>
<head>
<title>Your Title Here</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<form method=post action="SendMail.asp">
<input type="hidden" name="subject" value="Your Subject Here">
First Name<br>
<input type="text" name="first"><br>
Last Name<br>
<input type="text" name="last">
<br>
E-mail Address<br>
<input type="text" name="email">
<br>
Comments:
<br>
<textarea name="comments"></textarea>
<br>
<input type="submit" name="Submit" value="Submit">
<input type="reset" name="clear" value="Clear it">
</form>
</body>
</html>

Step 3: Edit the form to match your preferences and variables and save your new HTML page. For this example, we have saved this page as form.html

Step 4: Copy the ASP code below and paste it into a new document in your editor.
*Note this is only a sample form! Your form may be much more complex. Simply use this as a starting point and customize your form to your needs.  The parts in RED are really the only parts that are necessary/recommended for your ASP to work with this script.

<%
Set Mail = Server.CreateObject("Persits.MailSender")
Mail.Host = "mailx.nethere.net"

strBody = strBody & "First Name: " & Request("first") & chr(13) & chr(10)
strBody = strBody & "Last Name: " & Request("last") & chr(13) & chr(10)
strBody = strBody & "Email Address: " & Request("email") & chr(13) & chr(10)
strBody = strBody & "    " & chr(13) & chr(10)
strBody = strBody & "Comments:   " & Request("comments") & chr(13) & chr(10)
Mail.From = Request("email")
Mail.FromName = Request("email")
Mail.AddAddress "webhosting@nethere.com", "Web Hosting"
Mail.AddCC "webhosting2@nethere.com"
Mail.AddBcc "webhosting3@nethere.com"

Mail.Subject = Request("subject")
Mail.Body = strBody

On Error Resume Next
Mail.Send
If Err <> 0 Then
Response.Write "An error occurred: " & Err.Description
End If
%>

<html>
<head>
<title>AspEmail Demo</title>
<meta http-equiv="Refresh" content="5;URL=http://www.nethere.net" />
</head>
<body bgcolor="#FFFFFF"> Thank you for your comments!<br> You will be redirected back to our home page in 5 seconds.
</body>
</html>

Step 5:  Edit the ASP to match the variables in your own form and save you new ASP page.  For this example, the ASP page was saved as SendMail.asp. 

The ASP is collecting the following variables from the form.html page:  “first”, “last”, “email”, “comments”.  It is formatting the variables into an e-mail with the subject "Your Subject Here" and sending it to webhosting@nethere.com, copying it to webhosting2@nethere.com, and blind copying it to webhosting3@nethere.com.

If you are still having trouble with ASP E-mail, please give us a call  at 1-888-638-4373 or write to us at webhosting@nethere.com.

Top

© 2001 NetHere, inc. All rights reserved.