我有个完整的代码,今天才测试通过的,还有带有html编程器的啊!
只要你复制下边代码就可以用了...
<script language="javascript">
function OpenHTMLEditor(){
window.open('htmleditor/editor.html','','width=768,height=500,top=10,left=10');
}
</script>
<%
action=request("action")
smtp_username=request("smtp_username")
smtp_pwd=request("smtp_pwd")
smtpserver=request("smtpserver")
send_name=request("send_name")
send_email=request("send_email")
receive_email=request("receive_email")
if action="ok" then
'==================================================
' 参数设置开始,请修改相应参数
smtpserver =smtpserver '发送邮件所使用的SMTP服务器,例如smtp.163.com
smtpuser =smtp_username '与SMTP服务器对应的邮箱用户名,
smtppwd =smtp_pwd '与SMTP服务器对应的邮箱密码
'如果SMTP服务器需要发信认证,则设置登录SMTP服务器的用户名和密码
'与相应SMTP服务器对应的邮件地址
'注意:很多SMTP服务器除了要验证用户名和密码外,还要验证发件人地
'址,比如163.com的SMTP服务器在检查发信人邮件地址是不是以163.com
'结尾,否则不予发送,因此,使用相应的信箱做为发信人信箱是必要的
send_email =send_email 'SMTP服务器发信邮箱,请修改
receive_email=receive_email '用来接收邮件的邮箱,请修改,可以与SMTP服务器发信邮箱不同
' 参数设置结束
'==================================================
topic = trim(Request("topic"))
yjbody = trim(Request("yjbody"))
set jmail= server.CreateObject ("jmail.message")
jmail.Silent = true '屏蔽例外错误,返回FALSE跟TRUE两值
jmail.Charset = "gb2312" '邮件的文字编码为国标
JMail.ContentType = "text/html" '邮件的格式为HTML格式
jmail.From = send_email
jmail.FromName = send_name
jmail.Subject = topic
jmail.AddRecipient receive_email
jmail.Body = yjbody
jmail.MailServerUserName =smtp_username
jmail.MailServerPassWord =smtp_pwd
isgo = jmail.Send(smtpserver)
if isgo then
msg="邮件发送成功!"
else
msg = "邮件发送失败!请检查您的输入是否有误!"
end if
jmail.Close
set jmail = nothing
end if
%>
<html>
<head>
<title>邮件发送系统</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"><style type="text/css">
<!--
body,td,th {
font-size: 12px;
}
-->
</style></head>
<body>
<%if msg<>"" then%>
<br><%=msg%><a href="javascript:history.go(-1)">返回上一页</a>
<%else%>
<form action="sendmail.asp" method=post>
<table cellpadding="2" cellspacing="1" bordercolordark="#CCCCCC" bordercolorlight="#CCCCCC" border="1" width="760" align=center>
<input type="hidden" name="action" value="ok">
<tr>
<td width="106" bgcolor="#BCBCBC" class=forumrow>您的邮箱用户名:</td>
<td width="643" colspan="3" bgcolor="#D7D7D7" class=forumrow><input name="smtp_username" type=text size=30>
<FONT color=#ff0000>*</FONT>[SMTP服务器对应的邮箱用户名]</td>
</tr>
<tr>
<td width="106" bgcolor="#BCBCBC" class=forumrow>您的邮箱密码:</td>
<td colspan="3" bgcolor="#D7D7D7" class=forumrow><input name="smtp_pwd" type=password size=30>
<FONT color=#ff0000>*</FONT>[SMTP服务器对应的邮箱密码]</td>
</tr>
<tr>
<td width="106" bgcolor="#BCBCBC" class=forumrow>您的SMTP服务器:</td>
<td colspan="3" bgcolor="#D7D7D7" class=forumrow><input name="smtpserver" type=text value="smtp.163.com" size=30>
<FONT color=#ff0000>*</FONT>[发送邮件所使用的SMTP服务器,例如smtp.163.com]</td>
</tr>
<tr>
<td width="106" bgcolor="#BCBCBC" class=forumrow>您的姓名:</td>
<td colspan="3" bgcolor="#D7D7D7" class=forumrow><input name="send_name" type=text size=30>
<FONT color=#ff0000>*</FONT></td>
</tr>
<tr>
<td width="106" bgcolor="#BCBCBC" class=forumrow>您的E-mail:</td>
<td colspan="3" bgcolor="#D7D7D7" class=forumrow><input name="send_email" type=text size=30>
<FONT color=#ff0000>*</FONT></td>
</tr>
<tr>
<td width="106" bgcolor="#BCBCBC" class=forumrow>收件人E-mail:</td>
<td colspan="3" bgcolor="#D7D7D7" class=forumrow><input name="receive_email" type=text size=30>
<FONT color=#ff0000>*</FONT></td>
</tr>
<tr>
<td width="106" bgcolor="#BCBCBC" class=forumrow>邮件标题:</td>
<td colspan="3" bgcolor="#D7D7D7" class=forumrow><input type=text name="topic" size=30>
<FONT color=#ff0000>*</FONT></td>
</tr>
<tr>
<td width="106" bgcolor="#BCBCBC" class=forumrow>邮件内容:</td>
<td colspan="3" bgcolor="#D7D7D7" class=forumrow><textarea name="yjbody" cols=80 rows=6 id="yjbody"></textarea>
<FONT color=#ff0000>*</FONT></td>
</tr>
<tr>
<td width="106" bgcolor="#BCBCBC" class=forumrow></td>
<td height=20 colspan="3" bgcolor="#D7D7D7" class=forumrow>
<input type="Submit" value="发送邮件" name="Submit">
<input type="reset" name="Clear" value="重新填写">
<input type=button name=b1 style="width:100px;" value="HTML编辑器" onClick="javascript:OpenHTMLEditor();"></td>
</tr>
</table>
</form><%end if%>
</body>
</html>