-
The following is the script using CDONTS
'********************************************* **********One of the most common ways to send form data is with the CDONTS component. In this script, we will send data from a basic text box and a textarea box.
The first thing you need to do is create a formpage.asp page with the code below:
<form name="YourFormName" method="Post" action="confirmation.asp">
<table>
<tr><td>Email: </td>
<td><input type="text" name="Email" size="50"></td></tr>
<tr><td>First Name: </td>
<td><input type="text" name="FirstName" size="50"></td></tr>
<tr><td>Last Name: </td>
<td><input type="text" name="LastName" size="50"></td></tr>
<tr><td>Subject: </td>
<td><input type="text" name="Subject" size="50"></td></tr>
<tr><td>Comments: </td>
<td><textarea name="Comments"></textarea></td>
</table>
<input type="submit" name="Submit" value="Submit Form">
</form>
Next, we create a resultspage.asp page and enter the code as seen below:
<%
DIM strEmail, strName, strComments, mail, reply, objMail
strEmail = request.form("Email")
strName = request.form("Name")
strComments = request.form("Comments")
mail = ("YOUR EMAIL ADDRESS HERE")
reply = request.form("Email")
Set objMail = Server.CreateObject("CDONTS.NewMail")
objMail.From = reply
objMail.Subject = "YOUR SUBJECT MESSAGE HERE"
objMail.To = mail
objMail.Body = "Email: " & strEmail & vbCrLf & _
"Name: " & strName & vbCrLf & _
"Comments: " & vbCrLf & strComments
objMail.Send
Set objMail = nothing
%>
<%
strName = request.form("Name")
Response.Write strName
%>,</P>
Thank you for emailing me.</P>
Now you have a complete form that sends data to an email address and displays a customized message for your user. The default for CDONTS is to send text messages. If you want to send HTML messages you can simply include these two extra lines of code before the objMail.Body line.
objMail.BodyFormat=0
objMail.MailFormat=0
-
One more example CDONTS Code:
<%
SUB sendmail( fromWho, toWho, Subject, Body )
DIM myMail
Set myMail = Server.CreateObject("CDONTS.Newmail")
myMail.From = fromWho
myMail.To = toWho
myMail.Subject = Subject
myMail.Body = Body
myMail.Send
END SUB
fromWho = TRIM( Request.Form( "fromWho") )
toWho = TRIM( Request.Form( "toWho") )
Subject = TRIM( Request.Form( "Subject" ) )
Body = TRIM( Request.Form( "Body") )
If toWho <> "" THEN
sendMail fromWho, toWho, Subject, Body
Response.redirect "confirmation.html"
END IF
%>
<HTML>
<HEAD><TITLE>Email Form</TITLE></HEAD>
<FORM METHOD="POST" ACTION="<%=Request.ServerVariables("SCRIPT_NAME")% >">
TO: <INPUT NAME="toWho" TYPE="text" SIZE=40>
FROM: <INPUT NAME="fromWho" TYPE="text" SIZE=40>
SUBJECT: <INPUT NAME="Subject" TYPE="text" SIZE=40>
<TEXTAREA NAME="Body" COLS=40 ROWS=5></TEXTAREA>
<INPUT TYPE="SUBMIT" VALUE="Send Mail">
</FORM>
</HTML>
-
nice.....
In Linux server attackers tries to target the rc.d file to plant backdoor programs.Do remember to check each ‘rc’ files for programs that you are not familiar of or that have not been added recently.
tom...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks