<% Dim rsNews, strEmail, strConfirm, strSQL objConnOpen strEmail = Trim(Request("email")) strConfirm = Trim(Request("confirm")) If strConfirm = "yes" Then 'confirm the subscription strSQL = "UPDATE newsletter SET confirm = '"&strConfirm&"' WHERE email = '"&strEmail&"'" 'objConn.Mode = 3 'objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;"&_ '"Data Source = "&strDBPath&";"&_ '"User Id=Admin;Password=" objConn.Execute strSQL Response.Write "


" & _ "" & _ "Success! " & strEmail & " has been confirmed!" & _ "

Thank you for subscribing to the " & strSiteTitle & " newsletter

" ElseIf strConfirm = "no" Then 'New subscriber Set rsNews = Server.CreateObject("ADODB.Recordset") strSQL = "SELECT * FROM newsLetter WHERE email = '" & strEmail & "';" rsNews.Open strSQL, objConn, adOpenForwardOnly, adLockOptimistic, adCmdText If NOT rsNews.EOF Then Response.Write "
This email address is already subscribed!
" rsNews.Close set rsNews = Nothing Else strSQL = "INSERT INTO newsletter ([email],[Date],[confirm]) VALUES('" & strEmail & "','" & Now & "','" & strConfirm & "')" 'objConn.Mode = 3 'objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;"&_ '"Data Source = "&strDBPath&";"&_ '"User Id=Admin;Password=" objConn.Execute strSQL Set rsNews = Server.CreateObject("ADODB.Recordset") rsNews.Open "newsLetter", objConn, adOpenForwardOnly, adLockOptimistic, adCmdTable dim mailObj, cdoMessage, cdoConfig, addrList, strEmailMsg, subject subject = strSiteTitle & " Newsletter confirmation" 'send email so subscriber can confirm strEmailMsg = "Thank you for subscribing to the " & strSiteTitle & " Newsletter

" & _ "Please confirm your subscription by clicking on the link below.

" & _ "" & _ "confirm

" & _ "You received this email because you submitted this email address to our mailing list.
" & _ "If you did not subscribe or wish to be removed from our list - click on the link below

" & _ "" & _ "cancel

" & _ "Our Thanks
" & strSiteTitle 'Send email based on mail component. 'Send email (CDONTS version). Note: CDONTS doesn't support a reply-to 'address and has no error checking. if mailComp = "CDONTS" then set mailObj = Server.CreateObject("CDONTS.NewMail") mailObj.BodyFormat = 0 mailObj.MailFormat = 0 mailObj.From = fromAddr mailObj.To = strEmail mailObj.Subject = subject mailObj.Body = strEmailMsg mailObj.Send set mailObj = Nothing end if 'Send email (CDOSYS version). if mailComp = "CDOSYS" then set cdoMessage = Server.CreateObject("CDO.Message") set cdoConfig = Server.CreateObject("CDO.Configuration") cdoConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 cdoConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = smtpServer cdoConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") = fromAddr cdoConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "tufwfo" cdoConfig.Fields.Update set cdoMessage.Configuration = cdoConfig cdoMessage.From = "" & strSiteTitle & " <" & fromAddr & ">" cdoMessage.To = strEmail cdoMessage.Subject = subject cdoMessage.HtmlBody = strEmailMsg on error resume next cdoMessage.Send If Err.Number <> 0 Then Response.Write = "Email send failed: " & Err.Description & "." Else Response.Write "


" & _ "" & _ "An email has been sent to:

" & strEmail & "

" & _ "Confirm your subscription by following the instructions in the email" & _ "

Thank for subscribing to the " & strSiteTitle & " Newsletter
" End If set cdoMessage = Nothing set cdoConfig = Nothing end if 'Send email (JMail version). if mailComp = "JMail" then set mailObj = Server.CreateObject("JMail.SMTPMail") mailObj.Silent = true mailObj.ServerAddress = smtpServer mailObj.Sender = fromAddr mailObj.ReplyTo = fromAddr mailObj.Subject = subject mailObj.AddRecipient strEmail mailObj.ContentType = "text/html" mailObj.Body = strEmailMsg if not mailObj.Execute then SendMail = "Email send failed: " & mailObj.ErrorMessage & "." end if end if 'Send email (ASPMail version). if mailComp = "ASPMail" then set mailObj = Server.CreateObject("SMTPsvg.Mailer") mailObj.FromAddress = fromAddr mailObj.RemoteHost = smtpServer mailObj.ReplyTo = fromAddr mailObj.AddRecipient "", strEmail mailObj.Subject = subject mailObj.ContentType = "text/html" mailObj.BodyText = strEmailMsg if not mailObj.SendMail then SendMail = "Email send failed: " & mailObj.Response & "." end if end if rsNews.Close Set rsNews = Nothing End If Else If Request("cancel") = "yes" Then Set rsNews = Server.CreateObject("ADODB.Recordset") strSQL = "SELECT * FROM newsLetter WHERE email = '" & strEmail & "';" rsNews.Open strSQL, objConn, adOpenForwardOnly, adLockOptimistic, adCmdText If not rsNews.EOF Then rsNews.Delete Response.Write "


" & _ "" & _ " Success! " & strEmail & " has been removed from our database" & _ "

Sorry to see you go!
" End If rsNews.Close Set rsNews = Nothing Else %>

Enter the email address you want removed.
<% End If End If %>
 

<% objConnClose %>