Smart Mailer ASP Support Product Page
This topic was archived
sending an asp template with dynamic selection
Asked 07 Jul 2004 16:14:26
1
has this question
07 Jul 2004 16:14:26 tijger vandenhende posted:
I want to send a newsletter which is an asp file. The content of the various letters is stored in a database.The selection of the recipients and the newsletter is made by filling a form who sends the parameters to the sending page.
The selection of the recipents works perfectly but not the selection of the newsletter. I am selecting the newsletter by sending its record is to the sending page. here is the code :
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="../Connections/Limited.asp" -->
<!--#include file="../Connections/Limited.asp" -->
<!--#include file="../ScriptLibrary/incSmartMailer.asp" -->
<%
Dim destinataires__varcountry
destinataires__varcountry = "be"
If (Request.QueryString("country"
destinataires__varcountry = Request.QueryString("country"
End If
%>
<%
Dim destinataires__varlang
destinataires__varlang = "fr"
If (Request.QueryString("lang"
destinataires__varlang = Request.QueryString("lang"
End If
%>
<%
Dim destinataires
Dim destinataires_numRows
Set destinataires = Server.CreateObject("ADODB.Recordset"
destinataires.ActiveConnection = MM_Limited_STRING
destinataires.Source = "SELECT * FROM letsubscribers WHERE lang = '" + Replace(destinataires__varlang, "'", "''"
destinataires.CursorType = 0
destinataires.CursorLocation = 2
destinataires.LockType = 1
destinataires.Open()
destinataires_numRows = 0
%>
<%
Dim newsletter__MMColParam
newsletter__MMColParam = "1"
If (Request.QueryString("id"
newsletter__MMColParam = Request.QueryString("id"
End If
%>
<%
Dim newsletter
Dim newsletter_numRows
Set newsletter = Server.CreateObject("ADODB.Recordset"
newsletter.ActiveConnection = MM_Limited_STRING
newsletter.Source = "SELECT * FROM newsletters WHERE id = " + Replace(newsletter__MMColParam, "'", "''"
newsletter.CursorType = 0
newsletter.CursorLocation = 2
newsletter.LockType = 1
newsletter.Open()
newsletter_numRows = 0
%>
<%
' Smart Mailer 1.0.5
' Send on submit of form form1
if Request.ServerVariables("REQUEST_METHOD"
Server.ScriptTimeout = 300
Set sm1 = new SmartMailer
sm1.checkVersion "1.05"
sm1.contentCharset = "us-ascii"
Session.CodePage = sm1.getCodepage()
sm1.smtpSetup "", "", "", ""
sm1.pickup = ""
sm1.component = "cdo"
sm1.tmpFolder = ""
sm1.embedImages = false
sm1.progressBar = ""
sm1.ignore_errors = true
sm1.useQueue = false
sm1.setFrom "Limited Edition", " "
Set sm1.toRecord = destinataires
sm1.toRecordName = "name"
sm1.toRecordEmail = "mailad"
sm1.total_mail = sm1.getTotalRecords(destinataires)
while not sm1.toRecord.EOF
sm1.setTo sm1.toRecord.Fields.Item(sm1.toRecordName).Value, sm1.toRecord.Fields.Item(sm1.toRecordEmail).Value
sm1.Subject = ""
' using template for body
sm1.setBody_Template_html "newsletter.asp?id=<%= Request.QueryString("id"
' Attachments none
sm1.sendMail "multiple"
destinataires.MoveNext()
Wend
sm1.done()
end if
SM_mailAction = getMailAction()
%>
"
' Attachments none
sm1.sendMail "multiple"
destinataires.MoveNext()
Wend
sm1.done()
end if
SM_mailAction = getMailAction()
%>
"
' Attachments none
sm1.sendMail "multiple"
destinataires.MoveNext()
Wend
sm1.done()
end if
SM_mailAction = getMailAction()
%>
" ' Attachments none sm1.sendMail "multiple" destinataires.MoveNext() Wend sm1.done()
end if SM_mailAction = getMailAction() %> " ' Attachments none sm1.sendMail "multiple"
destinataires.MoveNext() Wend sm1.done() end if SM_mailAction = getMailAction()
%> " ' Attachments none sm1.sendMail "multiple" destinataires.MoveNext() Wend
sm1.done() end if SM_mailAction = getMailAction() %>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form name="form1" method="post" action="<%=SM_mailAction%>">
<table width="80%" border="0" cellspacing="0">
<tr>
<td width="25%">Poster la newsletter ci dessous </td>
<td width="75%"><%= Request.QueryString("id"
</tr>
<tr>
<td colspan="2"><%=(newsletter.Fields.Item("id"
</tr>
<tr>
<td>Aux destinataires répondant aux critères suivants</td>
<td> pays : <%= Request.QueryString("country"
</tr>
<tr>
<td> </td>
<td></td>
</tr>
<tr>
<td colspan="2"><input type="submit" name="Submit" value="Submit"></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
</table>
</form>
</body>
</html>
<%
destinataires.Close()
Set destinataires = Nothing
%>
<%
newsletter.Close()
Set newsletter = Nothing
%>
when executing the above code I am receiving the following error message :
Microsoft VBScript compilation error '800a0401'
Expected end of statement
/management/nletpost.asp, line 81
sm1.setBody_Template_html "newsletter.asp?id=<%= Request.QueryString("id"
----------------------------------------------------------------------^
Can you help about this ?
Replies
Replied 16 Jul 2004 14:30:04
16 Jul 2004 14:30:04 Camillah Ringes replied:
The line:
sm1.setBody_Template_html "newsletter.asp?id=<%= Request.QueryString("id"
%>"
should be:
sm1.setBody_Template_html "newsletter.asp?id=" & Request.QueryString("id"
--------------------------------------------------
Camillah Ringes
Support Team DMXzone.com
--------------------------------------------------
sm1.setBody_Template_html "newsletter.asp?id=<%= Request.QueryString("id"
should be:
sm1.setBody_Template_html "newsletter.asp?id=" & Request.QueryString("id"
--------------------------------------------------
Camillah Ringes
Support Team DMXzone.com
--------------------------------------------------
Replied 17 Jul 2007 08:57:40
17 Jul 2007 08:57:40 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
"Smart Mailer - how to merge fields into template" www.dmxzone.com/forum/topic.asp?topic_id=39080&NewsId=5578
Best Wishes,
Justin

