jmail发送密码

小岛风语 2008-03-30 03:27:15
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../../Connections/connmem.asp" -->
<%
Dim Recordset1__MMColParam
Recordset1__MMColParam = "1"
If (Session("MM_Username") <> "") Then
Recordset1__MMColParam = Session("MM_Username")
End If
%>
<%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_connmem_STRING
Recordset1.Source = "SELECT * FROM member WHERE m_user = '" + Replace(Recordset1__MMColParam, "'", "''") + "'"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()

Recordset1_numRows = 0
email = request.Form("m_email")
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 = "***@***.com" ' 发送者地址
JMail.FromName = "lam" ' 发送者姓名
JMail.MailServerUserName = "***@***.com" ' 身份验证的用户名
JMail.MailServerPassword = "******" ' 身份验证的密码
'加入新的收件人
'JMail.AddRecipient gfishery
'JMail.AddRecipientBCC Email '密件收件人的地址
'JMail.AddRecipientCC Email '邮件抄送者的地址
JMail.Subject = "您好"
JMail.AddRecipient email
JMail.Body = "尊敬的用户您好,首先感谢您使用我们的服务!." & VBCrLf & vbCrLf
JMail.Body = JMail.Body & "您的用户名是:" &Recordset1.Fields.Item("m_user").Value & vbCrLf
JMail.Body = JMail.Body & "您的注册邮箱是:" &Recordset1.Fields.Item("m_email").Value & vbCrLf
JMail.Body = JMail.Body & "您的登录密码是:" &Recordset1.Fields.Item("m_pasd").Value & vbCrLf
JMail.Body = JMail.Body & "请妥善保管您的密码,如再次遗忘密码,请登录至http://www.emaichina.net/member/memberpage/getbackpass.asp 取回您的密码,谢谢您使用本系统。" & vbCrLf
JMail.Body = JMail.Body & "顺祝商祺!" & vbCrLf
JMail.Body = JMail.Body & "译媒艺术咨询有限公司"
'增加一个普通附件
'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.***.com" ) then '执行邮件发送(通过邮件服务器地址)smtp.域名.com 不一定是邮件服务器
response.Write("邮件发送成功")
else
response.Write("邮件发送失败")
end if
JMail.Close()
Set JMail = Nothing
%>
<!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>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>






错误类型:
ADODB.Field (0x800A0BCD)
BOF 或 EOF 中有一个是“真”,或者当前的记录已被删除,所需的操作要求一个当前的记录。
/member/wjmm/sendmail.asp, 第 43 行 指这一行(JMail.Body = JMail.Body & "您的用户名是:" &Recordset1.Fields.Item("m_user").Value & vbCrLf )
...全文
65 点赞 收藏 8
写回复
8 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
Dogfish 2008-04-02
如果是使用mssql, 可以在query analyst里运行。
如果是access,可以在access里用query builder运行。
回复
Dogfish 2008-03-31
数据没有拿出来吧。吧你的sql语句打印出来,单独运行一下,看看是否有数据回来。
回复
Atai-Lu 2008-03-31
呃,楼上的是夜猫啊?
半夜才出来溜达,嘿嘿...
回复
<% end if
Recordset1.Close()
Set Recordset1 = Nothing
%>

放在关闭记录集之前
回复
小岛风语 2008-03-31
楼上,这end if该放哪?好像都没用?数据库有数据!
回复
小岛风语 2008-03-31
用4楼的,没显示错误,邮箱也没收到邮件.



6楼的兄弟你这一句怎么写,放哪.
回复
snlixing 2008-03-30
Recordset1.Open()

if not recordset1.eof then

Recordset1_numRows = 0

......

end if
回复
你记录为空时当然错误
回复
相关推荐
发帖
ASP
创建于2007-09-28

2.8w+

社区成员

ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
申请成为版主
帖子事件
创建了帖子
2008-03-30 03:27
社区公告
暂无公告