域名注册,企业邮局,虚拟主机 用户注册 | 新闻中心 | 用户管理 | 代理管理 | 独立面板 | 交费方式 | 联系我们
科技创造美好生活 您最佳的互联网伙伴
企业邮局 返回首页 域名注册 虚拟主机 企业邮局 网站制作 网站推广 IDC数据 人才招聘

  客户支持相关
常见热门问题
域名相关帮助
空间相关帮助
邮局相关帮助
财务相关帮助
代理相关帮助
网站推广帮助
网站制作相关教程
ASP发邮件例程 
2008-6-21 10:26:44 企星科技 浏览次数
关键字: ASP发邮件 - 本站搜索 - Google搜索 - Baidu搜索 - Yahoo搜索 - sougo搜索
关键字: ASP发邮件例程 - 本站搜索 - Google搜索 - Baidu搜索 - Yahoo搜索 - sougo搜索
<%
inputMailTo = Trim(Request.Form("inputMailTo"))
inputMailFrom = Trim(Request.Form("inputMailFrom"))
inputMailSubject = Trim(Request.Form("inputMailSubject"))
textBoxMailBody = Trim(Request.Form("textBoxMailBody"))

dim ErrMsgInputMailTo,ErrMsgInputMailFrom,ErrMsgInputMailSubject,ErrMsgTextBoxMailBody,MsgSendResult

sendMail

sub sendMail()
if inputMailTo = "" then
ErrMsgInputMailTo = "不能为空"
exit sub
end if
if ValidateEmail(inputMailTo) = false then
ErrMsgInputMailTo = "E-Mail Address Error"
exit sub
end if
if inputMailFrom = "" then
ErrMsgInputMailFrom = "不能为空"
exit sub
end if
if ValidateEmail(inputMailFrom) = false then
ErrMsgInputMailFrom = "E-Mail Address Error"
exit sub
end if
if inputMailSubject = "" then
ErrMsgInputMailSubject = "不能为空"
exit sub
end if
if textBoxMailBody = "" then
ErrMsgTextBoxMailBody = "不能为空"
exit sub
end if

Set mail = Server.CreateObject("CDONTS.NewMail")
mail.To = inputMailTo
mail.From = inputMailFrom
mail.Subject = inputMailSubject
mail.Body = textBoxMailBody
mail.Send

MsgSendResult = "发送成功!From: " + inputMailFrom + "; To: " + inputMailTo

end sub
%>
<html>
<head>
<title>发送邮件 By ASP</title>
</head>
<body>
<div align="center">

<table width="100%" border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#eeeeee" id="AutoNumber1">
<form id="formMail" method="post" action="">
<tr>
<td width="20%" height="24">收件人地址: </td>
<td width="80%" height="24">
<input type="text" id="inputMailTo" name="inputMailTo" size="48" value="<% = inputMailTo %>
">
<font color="#ff0000">
<strong>
<% = ErrMsgInputMailTo %>
</strong>
</font>
</td>
</tr>
<tr>
<td width="20%" height="24">发件人地址: </td>
<td width="80%" height="24">
<input type="text" id="inputMailFrom" name="inputMailFrom" size="48" value="<% = inputMailFrom %>
">
<font color="#ff0000">
<strong>
<% = ErrMsgInputMailFrom %>
</strong>
</font>
</td>
</tr>
<tr>
<td width="20%" height="24">邮件主题: </td>
<td width="80%" height="24">
<input type="text" id="inputMailSubject" name="inputMailSubject" size="48" value="<% = inputMailSubject %>
">
<font color="#ff0000">
<strong>
<% = ErrMsgInputMailSubject %>
</strong>
</font>
</td>
</tr>
<tr>
<td width="20%" height="24">邮件内容: </td>
<td width="80%" height="24">
<textarea id="textBoxMailBody" name="textBoxMailBody" Rows="6" Cols="48">
<% = textBoxMailBody %>
</textarea>
<font color="#ff0000">
<strong>
<% = ErrMsgTextBoxMailBody %>
</strong>
</font>
</td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="submit" value="Send Mail" id="buttonSendMail" name="buttonSendMail">
</td>
</tr>
<tr>
<td colspan="2" align="center" height="24">
</td>
</tr>
<tr>
<td colspan="2" align="center">
<font color="#ff0000">
<strong>
<% = MsgSendResult %>
</strong>
</font>
</td>
</tr>
</form>
</table>



</div>
</body>
</html>

<%
Function ValidateEmail(Expression)
Dim objRegExp
Set objRegExp = New RegExp
objRegExp.Pattern = "^[w.-]+@[w.-]+.[a-zA-Z]+$"
ValidateEmail = objRegExp.Test(Expression)
End Function
%>

关于我们 | 联系我们 | 汇款方式 | 价格总览 | 网站地图 | 合作伙伴 | 常见问题
企星旗下网站: 企星科技 - 星线空间 - 主机托管租用 - 网站建设 - 游戏点卡 - 家族天空 - 网络游戏推广 - 凤舞天骄 - 天骄2活力版 - 净化消毒设备网 - 揭西视窗
深圳搜房网 - 网游联盟 - 网吧联盟 - 粤东人才网 - 中文新闻网 - 天天旅游网 - 非主流交友网 - 网址大全 - 一起去聊天网 - 一品堂论坛 - 股票在线
Copyright © 2000-2008 WWW.86QX.COM All rights reserved
合作伙伴,备案编号:粤ICP备07056730号
企星科技有限公司·中国 版权所有