Forums

ASP

This topic is locked

SmartMailer dynamic "remove me" link on template

Posted 15 Dec 2004 06:20:58
1
has voted
15 Dec 2004 06:20:58 Jim Moore posted:
I am using SmartMailer to email a newsletter to subscribers. The extension works fine but I would like to create a dynamic "Remove me" link on my template that a user can use to invoke a program on my server and remove that user fom my mailing list. In a previous post xtomicino suggested that I could alter one line to pass the email address that is currently being mailed to my template. The revised code is

'using template for body
myTemplate = "somepage.asp?id=id=1&email=" & sm1.toRecord.Fields.Item(sm1.toRecordEmail).Value

sm1.setBody_Template_html my Template

Ques. Is myTemplate the name of a variable or the name of my template?

xtomicino then said to place the following in my template:


<a href="www.mywebsite.com/unsubscribe/default.asp?email=<%=requestquerystring("email""%>Remove me</a>

Ques: What is default.asp ? Is this a page with a record delete server behavior?

Here is my existing code on my smartmailer page:
<%
' Smart Mailer 1.0.3
' Send on submit of form form1
if Request.ServerVariables("REQUEST_METHOD" = "POST" then
Server.ScriptTimeout = 300
Set sm1 = new SmartMailer
sm1.checkVersion "1.03"
sm1.contentCharset = "iso-8859-1"
Session.CodePage = sm1.getCodepage()
sm1.smtpSetup "", "", "", ""
sm1.component = "cdo"
sm1.tmpFolder = ""
sm1.embedImages = false
sm1.progressBar = ""
sm1.ignore_errors = true
sm1.setFrom "Panama City Beach Guide", " "
Set sm1.toRecord = connSendenews
sm1.toRecordName = "id"
sm1.toRecordEmail = "email"
sm1.total_mail = sm1.getTotalRecords(connSendenews)
while not sm1.toRecord.EOF
sm1.setTo sm1.toRecord.Fields.Item(sm1.toRecordName).Value, sm1.toRecord.Fields.Item(sm1.toRecordEmail).Value
sm1.Subject = "Panama City Beach eNews"
' using template for body
sm1.setBody_Template_html "enews-v1-n8.html"
' Attachments none
sm1.sendMail "multiple"
connSendenews.MoveNext()
Wend
sm1.done()
Response.Redirect "mail-sent.html"
end if
SM_mailAction = getMailAction()
%>

Here is the code on my unsubscribe page:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="../Connections/connNewsletterLogin.asp" -->
<%
Dim rsUnsubscribe__MMColParam
rsUnsubscribe__MMColParam = "1"
If (Request.QueryString("email" <> "" Then
rsUnsubscribe__MMColParam = Request.QueryString("email"
End If
%>
<%
Dim rsUnsubscribe
Dim rsUnsubscribe_numRows

Set rsUnsubscribe = Server.CreateObject("ADODB.Recordset"
rsUnsubscribe.ActiveConnection = MM_connNewsletterLogin_STRING
rsUnsubscribe.Source = "SELECT * FROM users WHERE email = '" + Replace(rsUnsubscribe__MMColParam, "'", "''" + "'"
rsUnsubscribe.CursorType = 0
rsUnsubscribe.CursorLocation = 2
rsUnsubscribe.LockType = 1
rsUnsubscribe.Open()

rsUnsubscribe_numRows = 0
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
I'm not a very proficient programmer and need help in getting this unsubscribe function working?
Jim

Replies

Replied 17 Jul 2007 08:56:07
17 Jul 2007 08:56:07 Justin Moss replied:
I've developed a solution and posted it here:

"Smart Mailer - how to merge fields into template" www.dmxzone.com/forum/topic.asp?topic_id=39080&NewsId=5578

Best Wishes,
Justin

Reply to this topic