|
Call SendMail(mailtoaddress,mailtoname,subject,mailbody,fromname,mailfrom)
Function SendMail(MailtoAddress,MailtoName,Subject,MailBody,FromName,MailFrom)
'函数参数说明(收件人地址,收件人姓名(可选),主题,邮件内容,发件人姓名(可选),发件人地址)
MailtoAddress=rs("m_email") '收邮件的人
mailtoname=rs("m_firstname") '收件人的姓名
subject="你在三人行注册的账号信息" '邮件标题
mailbody="你的账号为"&rs("M_name")&"密码为"&rs("M_password") '邮件的内容
fromname="管理员" '发件人姓名
mailfrom="你的邮箱@163.com" '发件人邮箱
'on error resume next
Dim JMail,MailServer,Flag
Set JMail=Server.CreateObject("JMail.Message")
If err Then
SendMail = False
err.clear
Exit Function
End if
JMail.Charset="gb2312" '邮件编码
JMail.silent=True
JMail.ContentType = "text/html" '邮件正文格式
MailServer = "smtp.163.com" '用来发送邮件的SMTP服务器
JMail.MailServerUserName = "你的邮箱名" '登录用户名
JMail.MailServerPassWord = "你的密码" '登录密码
JMail.MailDomain = "163.com" '域名(如果用"name@domain.com"这样的用户名登录时,请指明domain.com),可选
JMail.AddRecipient MailtoAddress,MailtoName '收信人邮箱和收信人名称
JMail.Subject = Subject '主题
JMail.AppendHTML(MailBody)
JMail.FromName = FromName '发信人姓名
JMail.From = MailFrom '发信人Email
JMail.Priority = 3 '邮件等级,1为加急,3为普通,5为低级
Flag=JMail.Send(MailServer)
If Flag Then
SendMail=True
Else
SendMail=False
End If
JMail.Close
Set JMail=nothing
End Function |
|