[转帖]在DVBBS7.0Sp2中利用JMail发送邮件的解决方法
用Jmail发送邮件,经过一整天的摸索,终于成功了,能够自由的向内网和外网发送邮件。原来的症状是用自己写的ASP程序发送Jmail邮件可以成功,但是利用动网的JMail就是只能发到局域网,无法发送到外网。解决的办法是修改inc\Email.asp中的Jmail部分,我自己加了一点注释。
原来的程序是:
Sub Jmail(Email,Topic,Mailbody)
On Error Resume Next
Dim JMail
Set JMail = Server.CreateObject("JMail.Message")
JMail.silent=true
JMail.Logging = True
JMail.Charset = "gb2312"
If Not(Dvbbs.Forum_info(12) = "" Or Dvbbs.Forum_info(13) = "") Then
JMail.MailServerUserName = Dvbbs.Forum_info(12) '您的邮件服务器登录名
JMail.MailServerPassword = Dvbbs.Forum_info(13) '登录密码
End If
JMail.ContentType = "text/html"
JMail.Priority = 1
JMail.From = Dvbbs.Forum_info(5)
JMail.FromName = Dvbbs.Forum_info(0)
JMail.AddRecipient Email
JMail.Subject = Topic
JMail.Body = Mailbody
JMail.Send (Dvbbs.Forum_info(4))
Set JMail = Nothing
SendMail = "OK"
If Err Then SendMail = "False"
End Sub
改正的方法很简单,只要修改红色部分的地方就可以了。
Sub Jmail(Email,Topic,Mailbody)
On Error Resume Next
Dim JMail
Set JMail = Server.CreateObject("JMail.Message")
JMail.silent=true
JMail.Logging = True
JMail.Charset = "gb2312"
If Not(Dvbbs.Forum_info(12) = "" Or Dvbbs.Forum_info(13) = "") Then '不为空的时候
JMail.MailServerUserName = Dvbbs.Forum_info(12) '您的邮件服务器登录名 (邮局中任何一个Email用户)
JMail.MailServerPassword = Dvbbs.Forum_info(13) '登录密码
End If
JMail.ContentType = "text/html" '为网页格式邮件
JMail.Priority = 1 '优先级为高
JMail.From = AAA@BBB.COM '发件人Email,必须是你登录邮件服务器的邮箱
JMail.FromName = Dvbbs.Forum_info(0) '发件人姓名
JMail.AddRecipient Email '收件人邮箱
JMail.Subject = Topic '邮件主题
JMail.Body = Mailbody '邮件正文
JMail.Send (Dvbbs.Forum_info(4)) '发送者smtp服务器地址(企业邮局地址,例如SMTP.BBB.COM)
Set JMail = Nothing
SendMail = "OK"
End Sub
页:
[1]