<%
strType = Request.Querystring ("t")
strContinue = true
if strType = "u" then
strEmail = Request.Form ("txtEmail")
strFirst = Request.Form ("txtFirst")
strLast = Request.Form ("txtlast")
strToDo = Request.Form.Item (4)
if strToDo = "Subscribe" and (strEmail = "" or strFirst = "") then
Response.Write "You must enter your email address, and at least your first name!"
Response.End
end if
if inStr(strEmail, "@") = 0 or inStr(strEmail, ".") = 0 then
Response.Write "You must enter a valid email address!"
Response.End
end if
end if
if strType = "c" then
'this is a confirmation
end if
set cnn=server.CreateObject("adodb.connection")
cnn.Open strCnEm
Set rsPrisoner = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT * FROM Subscribers WHERE email = '" & strEmail & "'"
rsPrisoner.Open strSQL,cnn,3,3
if strToDo = "Subscribe" then
if rsPrisoner.EOF then
rsPrisoner.AddNew
rsPrisoner("email") = strEmail
rsPrisoner("fname") = strFirst
if strLast <> "" then
rsPrisoner("lname") = strLast
end if
rsPrisoner("subDate") = date
rsPrisoner("Confirmed") = false
strID = rsPrisoner("custID")
rsPrisoner.Update
'now, send a confirming email here
strToName = Request.Form ("txtFirst") & " " & Request.Form ("txtLast")
strToEmail = Request.Form ("txtEmail")
strFromName = "RachelMason.com"
strFromEmail = "Contact@RachelMason.com"
Dim objMsg
Set objMsg = CreateObject("CDO.Message")
Dim objConf
Set objConf = CreateObject("CDO.Configuration")
Dim Flds
Set Flds = objConf.Fields
With Flds
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServer) = "localhost"
.Item(cdoSMTPAuthenticate) = cdoAnonymous
.Update
End With
With objMsg
Set .Configuration = objConf
.To = CHR(34) & strToName & CHR(34) & " <" + strToEmail + ">"
.From = CHR(34) & strFromName & CHR(34) & " <" + strFromEmail + ">"
.Subject = "RachelMason Confirmation Page"
strBody = "Your email address has been subscribed to the RachelMason email list." & CHR(10) & chr(10)
strBody = strBody & "To prevent unauthorized submissions, RachelMason.com requires that all email list submissions be confirmed." & CHR(10) & chr(10)
strBody = strBody & "If you didn't subscribe to our newsletter, you need do nothing and you will be removed from our mailing list." & CHR(10) & chr(10)
strBody = strBody & "If you did subscribe, you need to confirm you subscription within 48 hours." & CHR(10) & chr(10)
strBody = strBody & "To confirm, click this link:" & CHR(10)
strBody = strBody & "HTTP://www.RachelMason.com/confirm.asp?d=" & strID & CHR(10) & CHR(10)
strBody = strBody & "AOL Users: Cut and paste the following into your address bar:" & CHR(10)
strBody = strBody & "HTTP://www.RachelMason.com/confirm.asp?d=" & strID
.TextBody = strBody
.send
End With
Set objMsg = Nothing
Set objConf = Nothing
Set Flds = Nothing
strMessage = "Thank you for subscribing! A confirmation email has been sent to you."
strContinue = false
else
strMessage = "This email address is already subscribed."
end if
end if
if strToDo = "UnSubscribe" then
if rsPrisoner.EOF then
strMessage = "This email address is not in our subscription list"
else
rsPrisoner.Delete
strMessage = "
We're sorry to see you go!
You have been unsubscribed. You may still receive email that has already been sent.
"
strContinue = false
end if
end if
rsPrisoner.Close
set rsPrisoner=nothing
cnn.Close
set cnn=nothing
%>