e-Mail ASP (CDONTS. NewMail) _ Application Tips

Source: Internet
Author: User
Formmail.htm
Copy Code code as follows:

<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<title> submit form to send mail </title>

<body>
<table width= "97%" border= "1" cellspacing= "5" cellpadding= "1" align= "center" bgcolor= "#EEFFF4" height= "630" >
<tr>
&LT;TD height= "440" >
<form action= "sendmail.asp" target= "_blank" method=post>
<input name= "MailTo" Type=hidden value= "dayechg@163.com" >
<input name= "title" Type= "hidden" id= "title" value= "Online booking" >
<table border=0 cellpadding=9 cellspacing=0
Width= "100%" >
<tbody>
<tr>
&LT;TD width= "44%" >
<div align=left><font size= "2" color= "#0000FF" > Name:</font> </div></td>
&LT;TD width= "56%" >
<div align=left><font size= "2" color= "#0000FF" >
<input name= name >
</font> </div></td>
</tr>
<tr>
&LT;TD width= "44%" >
<div align=left><font size= "2" color= "#0000FF" > Sex:</font> </div></td>
&LT;TD width= "56%" >
<div align=left><font size= "2" color= "#0000FF" > Male
<input CHECKED
name= sex Type=radio value= male >
Woman
<input name= Sex
Type=radio value= Female >
</font> </div></td>
</tr>
<tr>
&LT;TD width= "44%" >
<div align=left><font size= "2" color= "#0000FF" > Age:</font> </div></td>
&LT;TD width= "56%" >
<div align=left><font size= "2" color= "#0000FF" >
<input Name= Age >
*</font> </div></td>
</tr>
<tr>
&LT;TD width= "44%" >
<div align=left><font size= "2" color= "#0000FF" > Tel:</font> </div></td>
&LT;TD width= "56%" >
<div align=left><font size= "2" color= "#0000FF" >
<input Name= Tel >
*</font> </div></td>
</tr>
<tr>
&LT;TD width= "44%" >
<div align=left><font size= "2" color= "#0000FF" class= "unnamed1" >E-mail:</font> </div></ Td>
&LT;TD width= "56%" >
<div align=left>
<p class= "unnamed1" ><font size= "2" color= "#0000FF" >
<input name=email>
* </font> </p>
</div></td>
</tr>
<tr>
&LT;TD width= "44%" ><font size= "2" color= "#0000FF" > Booking:</font></td>
&LT;TD width= "56%" > <font size= "2" color= "#0000FF" >
<input name= booking id= "booking" value= "Please enter details" >
</font><font color= "#0000FF" > </font></td>
</tr>
<tr>
&LT;TD width= "44%" >
<div align=left><font size= "2" color= "#0000FF" > Set meal:</font> </div></td>
&LT;TD width= "56%" >
<div align=left><font size= "2" color= "#0000FF" >
<input name= Meal id= "order" value= "Please enter details" >
</font> </div></td>
</tr>
<tr>
&LT;TD width= "44%" class= "unnamed1" ><font color= "#0000FF" > Stationary transportation:</font></td>
&LT;TD width= "56%" ><font size= "2" color= "#0000FF" >
<input name= Transport id= "fixed means of transport" value= "Please enter details" >
</font></td>
</tr>
<tr>
&LT;TD width= "44%" class= "unnamed1" ><font color= "#0000FF" > Reservation:</font></td>
&LT;TD width= "56%" ><font size= "2" color= "#0000FF" >
<input name= id= "booking" value= "Please enter details" >
</font></td>
</tr>
<tr>
&LT;TD class= "unnamed1" ><font color= "#0000FF" > Set guide:</font> </td>
<td><font size= "2" color= "#0000FF" >
<input name= Guide Id= "Set the Guide" value= "Please enter the guide you want to set the conditions" >
</font> </td>
</tr>
<tr>
&LT;TD class= "unnamed1" ><font color= "#0000FF" > Hotel:</font></td>
<td><font size= "2" color= "#0000FF" >
<input name= Hotel id= "Ding Hotel" value= "Please enter the details" >
</font></td>
</tr>
<tr>
&LT;TD colspan=2>
<div align=center><font size= "2" color= "#0000FF" >
<input name=submit type=submit value= Confirmation >
<input name=reset type=reset value= cancellation >
</font> </div></td>
</tr>
</tbody>
</table>
<p> </p>
</form></td>
</tr>
</table>
</body>

Sendmail.asp
Copy Code code as follows:

<%
function SendMail (mailto,mailfrom,title,content)
' On Error Resume Next
Dim objcdomail
Set Objcdomail = Server.CreateObject ("CDONTS. NewMail ")
With Objcdomail
. From =mailfrom
. To =mailto
. Subject =title
. Body =content
. BodyFormat =0
. MailFormat =0
. Send
End With
Set Objcdomail = Nothing
If Err Then
Sendmail=false
Err. Clear
Else
Sendmail=true
End If
End Function

If request. Form<> "" Then
Mailto=trim (Request.Form ("MailTo"))
Mailform=trim (Request.Form ("email"))
Title=trim (Request.Form ("title"))
Content= ""
For each mailkey in Request.Form
content=content& "<br>" & Mailkey & ":" & Trim (Request.Form (Mailkey))
Next
ElseIf request. Querystring<> "" Then
Mailto=trim (Request.QueryString ("MailTo"))
Mailform=trim (Request.QueryString ("email"))
Title=trim (Request.QueryString ("title"))
Content= ""
For each mailkey in Request.QueryString
content=content& "<br>" & Mailkey & ":" & Trim (Request.QueryString (Mailkey))
Next
Else
Response. Write ("<script language=javascript>alert send email in the right way"); Window.close ();</script> ")
Response.End
End If
' Response. Write (content)
' Response. End ()
Pdsendmail=sendmail (mailto,mailform,title,content)
If not Pdsendmail then
Response. Write ("<script language=javascript>alert (' send failed '); Window.close ();</script>")
Else
Response. Write ("<script Language=javascript>alert (' send Success '); Window.close ();</script>")
End If
%>
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.