<% if Request.ServerVariables("REQUEST_METHOD") = "POST" then mailServer = "mail.yourhostname.com" strFrom = Request.Form("txtFrom") strEmailFrom = Request.Form("txtEmailFrom") priority = "" returnReceipt = "" toAddressList = recipient ccAddressList = "" bccAddressList = "" strSubject = Request.Form("txtSubject") strBody = Request.Form("txtBody") 'to apend a running footer strBody = strBody & vbCrLf strBody = strBody & vbCrLf strBody = strBody & vbCrLf strBody = strBody & "To change your email address or remove yourself from this list, please click on" strBody = strBody & vbCrLf strBody = strBody & "http://www.domain.org/optout.asp" attachmentList = "" 'for sql strDSNPath = "DSN=bulkemail;DRIVER={SQL Server};UID=ca;PWD=webcontent;" strSQL_SelectEmail = "SELECT email FROM bulk_email_main WHERE (i1 = 1);" 'for access ' strDSNPath = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=D:\UATP\fpdb\maillist.mdb" ' strSQL_SelectEmail = "SELECT Email from people WHERE (i1 = 1);" mailServer = "mail.yourhostname.com" Set mailer = Server.CreateObject("ocxQmail.ocxQmailCtrl.1") result = Mailer.SetHeloDomainName("ns.canonicaldomain.com") Set oConn = Server.CreateObject("ADODB.Connection") oConn.Open strDSNPath Set rsMail = oConn.Execute(strSQL_SelectEmail) if rsMail.BOF = True and rsMail.EOF = True then strResult = "The Database is Empty." else rsMail.MoveFirst Do While Not rsMail.EOF fromName = strFrom fromAddress = strEmailFrom messageSubject = strSubject messageText = strBody strTo = rsMail.Fields("email").Value If strTo <> "" then toAddressList = strTo Response.Write "Message sent: " & strTo & "
" iSuccess = iSuccess + 1 else Response.Write "Send Failure...Error was " & Mailer.Response & " User: " & strTo & "
" iFail = iFail + 1 end if 'strTo <> "" result = mailer.Q(mailServer, _ fromName, _ fromAddress, _ priority, _ returnReceipt, _ toAddressList, _ ccAddressList, _ bccAddressList, _ attachmentList, _ messageSubject, _ messageText _ ) rsMail.MoveNext Loop end if 'rsMail.BOF = True and rsMail.EOF = True Response.Write "

Mail Delivery Complete

" rsMail.Close Set rsMail = Nothing%>

Sent <%=iSuccess%> emails. <% oConn.Close Set oConn = Nothing end if 'REQUEST_METHOD = "POST" %>