jmail在线发信问题
[color=Red][size=4]jmail在线发信,都收不到邮件不知怎么回事,请教各位:[/size][/color]<%
on error resume next
Dim JMail
Set JMail=Server.CreateObject("JMail.Message")
JMail.Charset="gb2312" '邮件编码
JMail.silent=true
JMail.ContentType = "text/html" '邮件正文格式
'JMail.ServerAddress=MailServer '用来发送邮件的SMTP服务器
'如果服务器需要SMTP身份验证则还需指定以下参数
JMail.MailServerUserName ="XX"
JMail.MailServerPassWord ="XX"
JMail.AddRecipient("code520_net@sina.com")
JMail.Subject="Subject" '主题
JMail.Body="MailBody"
JMail.FromName="FromName" '发信人姓名
JMail.From = "MailFrom" '发信人Email
JMail.Priority=3
JMail.Send("smtp.sina.com.cn")
JMail.Close
if err then
response.write err.description
err.clear
else
response.write"ok"
end if
%> 怎么没有高手帮忙一下啊:L 前台页面代码-----------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Untitled Document</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="sendmail.asp">
<table width="570" border="1" align="center">
<tr>
<td colspan="2"><div align="center">发送邮件</div></td>
</tr>
<tr>
<td width="194">客户地址</td>
<td width="360"><input name="cemail" type="text" id="cemail" /></td>
</tr>
<tr>
<td>客户名称</td>
<td><input name="cname" type="text" id="cname" /></td>
</tr>
<tr>
<td>邮件标题</td>
<td><input name="emailtitle" type="text" id="emailtitle" /></td>
</tr>
<tr>
<td>邮件内容</td>
<td><textarea name="emailcontant" cols="50" rows="5" id="emailcontant"></textarea></td>
</tr>
<tr>
<td colspan="2"><div align="center">
<input type="submit" name="Submit" value="发送" />
</div></td>
</tr>
</table>
</form>
</body>
</html>
后台处理页面代码-----------------------------------
<%
cname=request.Form("cname")
cemail=request.Form("cemail")
emailtitle=request.Form("emailtitle")
emailcontant=request.Form("emailcontant")
Set JMail = Server.CreateObject("JMail.Message")
'是否将信头编码成iso-8859-1字符集. 缺省是True
JMail.ISOEncodeHeaders = True
'如果JMail.silent设置为true,ErrorCode包含的是错误代码
JMail.Silent = True
'设置标题和内容编码,如果标题有中文,必须设定编码为gb2312
JMail.Charset = "gb2312"
'JMail.ContentType = "text/html" '如果发内嵌附件一定要注释掉这行,重要!
JMail.From = "XXXXXXX@163.com" ' 发送者地址
JMail.FromName = "XXXXXX" ' 发送者姓名
JMail.MailServerUserName = "XXXXXXX" ' 身份验证的用户名
JMail.MailServerPassword = "XXXXXXX" ' 身份验证的密码
'加入新的收件人
JMail.AddRecipient cemail, cname
'JMail.AddRecipientBCC Email '密件收件人的地址
'JMail.AddRecipientCC Email '邮件抄送者的地址
JMail.Subject = emailtitle
JMail.Body = emailcontant
'增加一个普通附件
'JMail.AddAttachment(Server.MapPath())
'增加一个嵌入式附件
' The return value of AddAttachment is used as a
' reference to the image in the HTMLBody.
'contentId = JMail.AddAttachment(Server.MapPath("images/email.gif"))
'只有HTML格式支持嵌入图片附件,我们采用HTML格式的邮件内容
' As only HTML formatted emails can contain inline images
' we use HTMLBody and appendHTML
JMail.HTMLBody = "<html><body><br>"&emailcontant
JMail.appendHTML "<br><br></body></html>"
'如果对方信箱不支持HTML格式邮件,我们仍需要给他一个友善的提示
' But as not all mailreaders are capable of showing HTML emails
' we will also add a standard text body
JMail.Body = "Too bad you can't read HTML-mail."
JMail.appendText " "
if JMail.Send( "smtp.163.com" ) then '执行邮件发送(通过邮件服务器地址)smtp.域名.com 不一定是邮件服务器
response.Write("邮件发送成功")
else
response.Write("邮件发送失败")
end if
JMail.Close()
Set JMail = Nothing
%>
--------------------------------------------
要注意的是以前注册的163邮箱的被调用功能已经没了,
但是拓风的企业邮局支持,欢迎使用:)
代码分享给大家,希望技术之路走得更远
[[i] 本帖最后由 xunan 于 2008-4-7 23:24 编辑 [/i]] ding!!!!!!!!!!!!!!!!!!!!!
页:
[1]
