Unanswered: Creating a smart unsubscribe link in HTML body of a CDO email?
I am using CDO to send a bunch of emails from an MS SQL 2000 database on IIS. The body of the message is an HTML file that is created elsewhere (it actually has a lot of data-driven content, current news stories, etc.). This all works wonderfully. Here's the code:
msgStatus = ""
If (CStr(Request("sendmail"))) = "Click to send emails" Then
On Error resume Next
varMailFrom = "email@example.com"
varSubject = request.form("Subject")
Do UNTIL rsStr.EOF
Set MyCDO = Server.CreateObject("CDO.Message")
If IsObject (MyCDO) Then
MyCDO.From = varMailFrom
' This next line pulls the e-mail address from the recordset created previously
MyCDO.To = rsStr("DatabaseEmailAddress")
MyCDO.Subject = varSubject
' The file that becomes the body of the message sent out
MyCDO.value("Reply-to") = varMailFrom
Set MyCDO = nothing
' I use this variable to print out all the addresses the message was sent
' to after the page has been processed.
msgStatus = msgStatus & rsStr("WELemailAddress") & ".<br>"
' Error tracking to show when something goes wrong.
msgStatus = msgStatus & "Message not sent.<br>"
PROBLEM: I want to include an UNSUBSCRIBE link at the bottom of the message body (which is built from an ASP file) that directs them to a page on our Website where they can click to be removed from our mailing list. The page has a form on it that I would like to pre-fill with their e-mail address. Ideally, I'd like to pass the address via a query string appended to the url and then use that to populate the input field in the form:
The problem is, the page processing is on a separate page from the message and I cannot figure out how to pass the variable of the E-mail address to the page that is the body of the message.
Any other suggestions?
Oh, our server configuration (and our access to its features) makes it impossible for us to set up some type serverside script or trigger that would allow the server to process an e-mail sent to firstname.lastname@example.org, so let’s not stray down that path, okay?