Space
Logo
Space
Hae verkkotunnus ETSI
 

Tuki »Webbi »Koodaus »Windows / ASP »Lomakkeen lähetys

Mailform




In two .asp pages.
the first one (sendmail_form.asp) will collect the data in forms, and the second one (sendmail.asp) will process the actual mail sending



Sourcecode:



sendmail_form.asp:

<html>
<head>
<title>ASPSend mail example</title>
</head>

<body bgcolor="#FFFFFF" text="#000000">

<form action="sendmail.asp" method="POST">
<P>
Your Name:<BR>
<input type="Text" name="FromName" size="25" maxlength="50">
<P>
Your E-Mail Address:<br>
<input type="Text" name="FromAddress" size="25" maxlength="50">
<P>
Subject:<br>
<input type="Text" name="Subject" size="25" maxlength="50">
<P>
Message:<BR>
<textarea name="BodyText" cols="50" rows="10" wrap="PHYSICAL"></textarea>
<P>

<input type="Reset"> <input type="Submit" name="Send" value="Send">

</form>

</body>
</html>


sendmail.asp:



<html>
<head>
<title>ASPSend mail example</title>
</head>

<body>



<%



'Getting (Requesting) the Session variables from Form on previous page



Session("FromName")=Request("FromName")
Session("FromAddress")=Request("FromAddress")
Session("Subject")=Request("Subject")
Session("BodyText")=Request("BodyText")



Set Mailer=Server.CreateObject("SMTPsvg.Mailer")



'Setting variables

Mailer.FromName=Session("FromName")
Mailer.FromAddress=Session("FromAddress")
Mailer.RemoteHost="sharedrelay.active24.com"
Mailer.AddRecipient "Webmaster Active ISP", "webmaster@domain.com"
Mailer.Subject=Session("Subject")
Mailer.BodyText=Session("BodyText")
Mailer.Charset="2"



'Checking if mail sent ok, if not display error message



if Mailer.SendMail then
Response.Write "Mail sent..."
else
Response.Write "Mail send failure. Error was " & Mailer.Response
end if


'Abandoning session variables
Session.Abandon
%>



</body>
</html>


our partners     Space
       
Space
       
Space
       
Space
       
Space
       
       payment        Space
       
Space