JMail:The message was undeliverable. All servers failed to receive the message

jean5217 2009-05-05 02:01:02
JMail组建存在,但是始终发布出去。
代码如下:
email.asp 代码
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="func.asp"-->
<%
if request("action")="send" then
MailtoAddress=request("MailtoAddress")
MailtoName=request("MailtoName")
Subject=request("Subject")
MailBody=request("MailBody")
MailFrom="liushaqiong213@163.com"
FromName="liushaqiong213"
Priority=3
MailServerUser="liushaqiong213@163.com"
MailServerPass="******" 'liushaqiong213@163.com邮箱的对应密码
MailDomain="163.com"
MailServer="mail.163.com"
response.Write(MailtoAddress)
response.Write("<br>")
response.Write(MailBody)
response.Write("<br>")
call SendMail(MailtoAddress,MailtoName,Subject,MailBody,MailFrom,FromName,MailServerUser,MailServerPass,MailDomain,MailServer)
end if
%>
<!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>无标题文档</title>
</head>

<body><form action="email.asp" method="post">
<table width="600" align="center" bordercolordark="#FFFFFF" bordercolorlight="#0099FF" border="1" cellspacing="0" cellpadding="0">
<tr>
<td width="120" align="right"> 收信人地址:</td>
<td width="480">
<input type="text" name="MailtoAddress" />
<input type="hidden" name="action" value="send" /></td>
</tr>
<tr>
<td align="right"> 收信人名字:</td>
<td><input type="text" name="MailtoName" /></td>
</tr>
<tr>
<td align="right"> 主题:</td>
<td align="left"><input type="text" name="Subject" /></td>
</tr>
<tr>
<td align="right"> 信件内容:</td>
<td><label>
<textarea cols="50" rows="10" name="MailBody"></textarea>
</label></td>
</tr>
<tr>
<td colspan="2"> <input name="sendemail" type="submit" value="发送"/></td>
</tr>
</table>
</form>
</body>
</html>

func.asp 代码
<%
'函数名:SendMail
'作 用:用Jmail组件发送邮件
'参 数:MailtoAddress -----收信人信箱
' MailtoName -----收信人姓名
' Subject -----主题
' MailBody -----信件内容
' MailFrom -----发信人信箱
' FromName -----发信人姓名
' Priority -----信件优先级
' MailServerUser -----登陆邮箱用户名
' MailServerPass -----登陆邮箱密码
' MailDomain -----邮箱域名
' MailServer -----发件SMTP服务器
Function SendMail(MailtoAddress,MailtoName,Subject,MailBody,MailFrom,FromName,MailServerUser,MailServerPass,MailDomain,MailServer)
' on error resume next
Dim JMail,JMailstat
Set JMail=Server.CreateObject("JMail.Message")
if err then
err.clear
Response.Write "组件检测失败"
JMail.close()
Set JMail=nothing
exit function

end if
JMail.Charset="gb2312" '邮件字符集
JMail.silent=True '忽略错误
JMail.ContentType = "text/html" '邮件编码
JMail.AddRecipient MailtoAddress '收件人地址
JMail.ReturnReceipt = True '是否收条(验证中)
JMail.From = MailFrom '发件人邮箱
JMail.MailDomain=MailDomain '邮箱所在域名(验证中)
JMail.FromName = FromName '发件人姓名
JMail.MailServerUserName=MailServerUser '邮箱用户名
JMail.MailServerPassWord=MailServerPass '邮箱密码
JMail.Subject=Subject '邮件主题
JMail.Body=MailBody '邮件正文(纯文本格式)
'JMail.HMTLBody=MailBody '邮件正文(HTML格式)
JMail.Priority=1 '邮件等级,1为加急,3为普通,5为低级
JMailstat=JMail.Send(MailServer)
If JMailstat then
response.write "成功"
else
response.write "失败"
end if
Response.Write(JMail.ErrorMessage)
JMail.close()
Set JMail=nothing
End Function
%>
...全文
665 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhaoqiliang527 2009-07-27
  • 打赏
  • 举报
回复
'The message was undeliverable. All servers failed to receive the message ',这其实是JMAIL返回的错误,并不是ASP代码产生的,根本原因是MAIL SERVER拒绝了JMAIL的请求.

究其原因,是那些服务器不提供SMTP服务或者没有开启smtp服务;或是在服务器端开启了 '禁止邮件中继服务 '选项,也就是说不在其允许的IP段或指定范围内的空间里的程序是无法使用其SMTP服务的,最终导致 '8000ffff '错误发生。
如果系统是win2003的话,比较麻烦,因为在win2000里面,jmail 发送邮件的进程是 dllhost.exe 在win2003里面发送邮件进程是 w3wp.exe,所以在杀毒软件要设置允许w3wp.exe 这个进程发邮件

1、杀毒软件或者防火墙的原因
2、Jmail.dll组件的Everyone完全控制权限
3、如果机器上网是通过代理服务器的话,就无法使用JMail发送邮件。

应该是没有加上容错

Jmail.Silent=true

'JMAIL不会抛出例外错误,返回的值为FALSE跟TRUE

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧