永发信息网

asp+jmail自动发送邮件

答案:1  悬赏:70  手机版
解决时间 2021-05-01 07:30
  • 提问者网友:最美的风景
  • 2021-05-01 00:33

<%
  if UCase(Request.Form("Oper")) = "FINDPWD" then
   Dim rdsMember     '/创建会员账号访问对象/
   Dim sqlMember       '/创建SQL语句/
   Dim strMember    '/会员账号/
   Dim strPassword   '/管理密码/
   Dim strEmail
   Dim strContent
   Dim jmlSendEmail

   strMember = changechr(Request.Form("Member"))
            sjmail=IsObjInstalled("JMail.Message")
   set rdsMember = Server.CreateObject("ADODB.Recordset")
   sqlMember = "Select * From love_main Where username = '"& strMember &"'"
   rdsMember.Open sqlMember,Conn,1,1
   if not rdsMember.EOF then
    strPassWord = rdsMember("Password")
    strEmail = rdsMember("Email")
    strContent = "您在简爱的会员登陆密码为:"& strPassword &""
                If sjmail=false Then
                strMsg = "服务器不支持Jmail邮件发送组件,不能使用此功能!"
                else
    set jmlSendEmail = Server.CreateObject("JMAIL.Message")
    jmlSendEmail.Logging = True
    jmlSendEmail.Silent = True
    jmlSendEmail.Charset = "GB2312"
    jmlSendEmail.From ="chenke521xu@163.com"                             '/发件人E-Mail/
    jmlSendEmail.AddRecipient strEmail                               '/收件人E-Mail/
    jmlSendEmail.ContentType = "text/html"
    jmlSendEmail.Subject = "简爱会员登陆密码"             '/邮件的标题/
 
    jmlSendEmail.Body = strContent 
                                        '/文本格式/
    jmlSendEmail.Priority=1
    jmlSendEmail.MailServerUserName = "chenke521xu@163.com"
    jmlSendEmail.MailServerPassowrd = "chenke"
    
    jmlSendEmail.MailDomain ="stmp.163.com"                     '/发送邮件服务器SMTP Server/ 
    jmlSendEmail.Send("stmp.163.com")                              '/发送邮件服务器POP3 Server/
    jmlSendEmail.Close
    set jmlSendEmail = nothing
    
    strMsgTitle = "找回密码成功"
    strError = False
    strMsg = "找回密码成功,密码已发往您注册时填写的E-Mail:"&strEmail&",请注意查收..."
    strGoFile = "index.asp"
            end if
    Call ShowMessage()
   else
    Response.Write "<script>alert(""\您输入的会员帐号不存在,请重新输入!"");window.location='FindPwd.asp';</script>"
   end if
   rdsMember.Close
   set rdsMember = nothing
  else
  %>
   <script language="javascript">
   function FindPwdForm() {
    if (document.FindPwd.Member.value == "") {
     alert("\请输入您的会员帐号!");
     document.FindPwd.Member.focus();
    }
    else if ((document.FindPwd.Member.value).length<4) {
     alert("\会员帐号至少4位!");
     document.FindPwd.Member.focus();
    }
    else {
           return true;
       }
       return false;
   }
   </script>
          <table width="700" border="0" align="center" cellpadding="0" cellspacing="1">
          <form method="post" action="FindPwd.asp" name="FindPwd" OnSubmit="return FindPwdForm()">
          <input type="hidden" name="Oper" value="FindPwd">         
            <tr>
              <td width="100%" height="30" align="center">请输入您的会员帐号:&nbsp;
                <input type="text" name="Member" maxlength="15" class="ipt2">&nbsp;<input type="submit" name="Submit" value="查找密码" class="button"></td>
            </tr>
          </form>
          </table>
  <%end if%>

 

 

 

<%
function changechr(str)
    changechr=replace(replace(replace(replace(str,"<","&lt;"),">","&gt;"),chr(13),"<br>")," ","")
   changechr=replace(replace(replace(replace(changechr,"'",""),"and",""),"insert",""),"set","")
    changechr=replace(replace(replace(replace(changechr,"select",""),"update",""),"delete%20from",""),chr(34),"&quot;")
end function
Sub ShowMessage()
 if strMsgTitle = "" then strMsgTitle = "异常出错"
 if strMsg = "" then strMsg = "未知错误"
%>
  <br>
  <table border="0" width="70%" cellspacing="0" cellpadding="0" align="center">
 <tr>
   <td width="100%" bgcolor="#3986CE">
  <table border="0" width="100%" cellspacing="1">
    <tr>
      <td width="100%" align="center" bgcolor="#3986CE" height="30"><% = strMsgTitle%></td>
    </tr>
    <tr>
      <td width="100%" align="center" height="68" bgcolor="#FFFFFF" style="line-height:200%"><% = strMsg%></td>
    </tr>
          <tr>
            <td width="100%" align="center" height="25" ><input onclick="parent.location.href='Javascript:history.back()'" type="button" value="返 回" class="face" name="button1"></td>
          </tr>
        </table>
      </td>
    </tr>
  </table>
  <br>
<%End Sub%>邮件发送不成功

最佳答案
  • 五星知识达人网友:持酒劝斜阳
  • 2021-05-01 02:10

你启动asp的服务器了吗?


我的可以发送。

我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯