You are Here:
FAQ
Script Cookbook & Databases
ASP
Article #6
|
How to use ASP Mail ComponentASP Mail is an Active Server Component designed to send e-mail from an Active Server Page. This component is installed on our servers. Below is a sample Asp script that use Asp Mail component to send the feedback form information back to your desired e-mail address. You can edit the following script to your requirements. Script : forminfo.asp
<% @LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<%
Set Mail = Server.CreateObject("SMTPsvg.Mailer") 'create an Asp mail component.
Mail.FromName = "1&1 Test"
Mail.FromAddress= Request.Form("email")
Mail.RemoteHost = "mrvnet.kundenserver.de" ' The mail server you have to use with Asp Mail
Mail.AddRecipient "Your Name", "support@1and1.co.uk"
Mail.Subject = "Website - Info Request"
Mail.BodyText = Request.Form("Info")
if Mail.SendMail then
Response.Write "Your mail has already been sent..."
else
Response.Write "Mail send failure. Error was " & Mail.Response
end if
Set Mail = Nothing
%>
</body>
</html>
You will then need to create a form to use this script. Script : info.html (Feedback Form)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>ASP Mail Test page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body background="" >
<table width="100%" border="0" align="center">
<tr class="medium">
<td width="54%" align="center" valign="top">
<form onSubmit="return ValidateForm()" name="form1" method="post" action="forminfo.asp">
<p class="fancycentre" align="left">Email Address
<input name="email" type="text" id="email" size="41"></p>
<p class="fancycentre" align="left"> </p>
<p class="fancycentre" align="left">Please enter your comment below:</p>
<p class="fancycentre" align="left"><br>
<textarea name="info" cols="35" rows="10" id="textarea3"></textarea></p>
<p class="fancycentre" align="left">
<input class="fancybut" type="submit" name="Submit" value="Submit Form">
<input class="fancybut" type="reset" name="Submit2" value="Reset Form"></p>
</form></td>
<td width="16%" align="right" valign="top"></td>
</tr>
</table>
</body>
</html>
|
© 2007 1&1 Internet Ltd - About 1&1 Internet