|
ASP Sample Codes:
Display Current Date/Time Send Email
|
- Use Insert, Form, Form to insert a form;
- Use Insert, Form, One Line Text Box to insert the frmFrom input field, right click the text box, select Form Field Properties, type
frmFrom in the Name box as shown in the picture below:

- Use Insert, Form, One Line Text Box to insert the frmTo input field, right click the text box, select Form Field Properties,
type frmTo in the Name box;
- Use Insert, Form, One Line Text Box to insert the frmSubject input field, right click the text box, select Form Field Properties, type
frmSubject in the Name box;
- Use Insert, Form, Scrolling Text Box to insert the frmMessage input field, right click the text box, select Form Field Properties, type
frmMessage in the Name box;
- Right click the form, select Form Properties, then click Send to other as shown in the picture below:
- Then click the Options, type sendmail.asp in the Action field.
- Then create a file named "sendmail.asp" with the following code:
<%@ Language=VBScript %>
<%
strFrom = Request.Form("frmFrom")
strTo = Request.Form("frmTo")
strSubject = Request.Form("frmSubject")
strMessage = Request.Form("frmMessage")
Response.Write "Sending email to: <B>" & strTo & "</B> .. "
Set objMail = Server.CreateObject("CDONTS.NewMail")
objMail.To = strTo
objMail.From = strFrom
objMail.Value("Reply-To") = strFrom
objMail.Subject = strSubject
objMail.Body = strMessage
objMail.Send
Set objMail = Nothing
Response.Write "done"
%>
|
|