If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Creating a smart unsubscribe link in HTML body of a CDO email?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-24-06, 15:25
buzzter66 buzzter66 is offline
Registered User
 
Join Date: Nov 2002
Location: Houston, Texas
Posts: 85
Question 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
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.

I’ve 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 let’s not stray down that path, okay?

Thanks in advance for any and all help!

;-)
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On