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
Dim varSubject
Dim varMailTo
Dim varMailFrom
Dim MyCDO
varMailFrom = "info@oururl.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.CreateMHTMLBody "http://www.oururl/emailFile.asp"
MyCDO.value("Reply-to") = varMailFrom
MyCDO.Send
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.
Else
msgStatus = msgStatus & "Message not sent.<br>"
End If
rsStr.MoveNext
Loop

End If
%>

---------------------------------

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:

www.oururl.com/unsubscribe.asp?email=ME@EMAIL.COM


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.

Ive been wondering if I could have the processing script append a string to the body when it creates the message. If so, I could probably use client-side javascript in the message to pull in the variable.

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 unsubscribe@oururl.com, so lets not stray down that path, okay?

Thanks in advance for any and all help!

;-)