10分请教企业邮局邮件不能作为JMAIL发送邮件的原因
从论坛上获得JMAIL发送邮件的代码,根据实际情况修改如下:sendmail.asp:
<%
Function sendMail(mailForm, mailFormName, mailTo, mailSubject, mailContent)
On error resume next
Dim JMail, contentId
Set JMail = Server.CreateObject( "JMail.Message ")
JMail.Charset = "gb2312 "
JMail.From = mailForm
JMail.FromName = mailFormName
JMail.Subject = mailSubject
JMail.MailServerUserName = "webmaster@aaa.com.cn "
JMail.MailServerPassword = "123456 "
JMail.Priority = 1
JMail.AddHeader "Originating-IP ", Request.ServerVariables( "REMOTE_ADDR ")
JMail.AddRecipient mailTo
JMail.HTMLBody = mailContent
JMail.Send( "mail.aaa.com.cn ") '企业邮局的POP3和SMTP服务器都是这个
JMail.Close()
Set JMail = Nothing
End Function
%>
接收提交过来的注册信息,往注册的邮件发送邮件,处理代码save.asp如下:
acemail=request.Form( "Email ")
receivecard=request.Form( "UserName ")
sender= "北京天下公司 "
sendemail = "webmaster@aaa.com.cn "
mailForm = "webmaster@aaa.com.cn "
mailFormName = "系统管理员 "
mailSubject = receivecard & ",您好,已收到你的注册信息! "
emailTo = acemail
mailContent = " <p align=left> 亲爱的 "&receivecard& ": </p> <p align=center> "&sender & "[ "&sendemail& "]已收到你的注册信息,如果你是申请正式会员,我们会在审核后通知你是否成为正式会员 "
call sendMail(mailForm, mailFormName, emailTo, mailSubject, mailContent)
这样是发不出去邮件,但没有错误提示或者退回的提示,但是如果把sendmail.asp中邮件改为免费的邮件,比如163的,以本人的为例:
<%
Function sendMail(mailForm, mailFormName, mailTo, mailSubject, mailContent)
On error resume next
Dim JMail, contentId
Set JMail = Server.CreateObject( "JMail.Message ")
JMail.Charset = "gb2312 "
JMail.From = mailForm
JMail.FromName = mailFormName
JMail.Subject = mailSubject
JMail.MailServerUserName = "helloboy@163.com "
JMail.MailServerPassword = "123456 "
JMail.Priority = 1
JMail.AddHeader "Originating-IP ", Request.ServerVariables( "REMOTE_ADDR ")
JMail.AddRecipient mailTo
JMail.HTMLBody = mailContent
JMail.Send( "smtp.163.com ")
JMail.Close()
Set JMail = Nothing
End Function
%>
这样注册成功后在注册用户提交的邮箱里就会收到一封邮件,问题会在什么地方呢?
我看企业邮局的帮助里说
收信服务器(POP3):mail.yourdomain.com
发信服务器(SMTP):mail.yourdomain.com
用户名:yourname@yourdomain.com (注:应填入邮件地址全称)
注意:必须选中“我的服务器要求身份验证”,如果是在本地用outlook来收发邮件,这个我知道,应该选中“我的服务器要求身份验证”,但是如果在程序里用JMAIL,我就不知道该怎么设置,或者说用企业邮局的邮件发不出去的原因我就不知道了。