if Request.ServerVariables("REQUEST_METHOD") = "POST" then strSubject = Request.Form("txtSubject") strBody = Request.Form("txtBody") strFrom = Request.Form("txtFrom") ' 从数据库选取收件人记录 strSQL_SelectEmail = "SELECT Guests.Guest_ID, Guests.Guest_Email " & _ " FROM Guests WHERE ((Guests.Mail_List)=-1);" Set oConn = Server.CreateObject("ADODB.Connection") oConn.Open strDSNPath Set rsMail = oConn.Execute(strSQL_SelectEmail) if rsMail.BOF = True and rsMail.EOF = True then ...数据库为空提示,略... else rsMail.MoveFirst Do While Not rsMail.EOF ' 创建对象 Set Mailer = Server.CreateObject("SMTPsvg.Mailer") ' 填写其它邮件标题信息 Mailer.FromName = strFrom Mailer.FromAddress = strEmailFrom Mailer.RemoteHost = strHost Mailer.Subject = strSubject Mailer.BodyText = ...设置邮件内容,略... strTo = rsMail.Fields("Guest_Email").Value If strTo < > "" then Mailer.Recipient = strTo if Mailer.SendMail then ...发送成功提示,略... else ...发送失败提示,略... end if 'Mailer.SendMail end if 'strTo < > "" rsMail.MoveNext Set Mailer = Nothing Loop end if 'rsMail.BOF = True and rsMail.EOF = True rsMail.Close Set rsMail = Nothing oConn.Close Set oConn = Nothing end if 'REQUEST_METHOD = "POST"