Forums
This topic is locked
create ASP report and have it emailed automaticall
Posted 20 Oct 2004 02:26:12
1
has voted
20 Oct 2004 02:26:12 colin hart posted:
I have a ASP page that I created that shows yesterdays activity for a database which works great when a user logs into the site and opens that page. I want to have that page emailed to all my users, not a link but take the page and have an html email sent to my users (stored in a SQL database) everynight. We have over 1000 users so it will be a big batch of emails.I am using Exchange 5.5 for email
Webserver is sql2000 and I mostly program in ASP
what suggestions do you have for me?
Replies
Replied 20 Oct 2004 14:18:06
20 Oct 2004 14:18:06 Rene Bandsma replied:
Think this is not possible. ASP is an scripting language to display text in a browser or process some functions to the server while loading the page or when a user interacts with the ASP script.
If you want to mass-mail all your addressees at once at a certain time every day you should do some things manually (like clicking on OK or load a page). With the Smart Mail Processor you can easily add your wanted fuctionality to your webpage.
If you want to mass-mail all your addressees at once at a certain time every day you should do some things manually (like clicking on OK or load a page). With the Smart Mail Processor you can easily add your wanted fuctionality to your webpage.
Replied 20 Oct 2004 18:06:06
20 Oct 2004 18:06:06 colin hart replied:
what is the Smart Mail Processor?
Replied 20 Oct 2004 20:24:01
20 Oct 2004 20:24:01 Rene Bandsma replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
what is the Smart Mail Processor?
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
A great extension from the developers of DMXZone: www.dmxzone.com/ShowDetail.asp?NewsId=5578
what is the Smart Mail Processor?
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
A great extension from the developers of DMXZone: www.dmxzone.com/ShowDetail.asp?NewsId=5578
Replied 25 Oct 2004 17:01:45
25 Oct 2004 17:01:45 Lee Diggins replied:
Hi Colin
You can do this a number of different ways, all dependent on your configuration. One of the simplest ways would be to write a VBS file (just like ASP/VBScript) and create a task in Windows Scheduler to run every night.
Have you coded for this kind of thing before?
Digga
Sharing Knowledge Saves Valuable Time!!!
You can do this a number of different ways, all dependent on your configuration. One of the simplest ways would be to write a VBS file (just like ASP/VBScript) and create a task in Windows Scheduler to run every night.
Have you coded for this kind of thing before?
Digga
Sharing Knowledge Saves Valuable Time!!!
Replied 25 Oct 2004 17:36:45
25 Oct 2004 17:36:45 colin hart replied:
hey digga
thanks for the response. I got a simple one of these working using that Mail Processor but this next one is too difficult for it to handle.
here is my latest project
I am building a site for a real estate company and they want the ability for visitors to record their search criteria and and have the server run that criteria every night and email them if there are listings.
Currently now I have I form online where they insert the search criteria (Price Range High, Price range Low, bed, bath, square footage, City and House Type) and their email address into a table named SavedSearchCriteria. I got that part working great. Now I need to have it. Then I have a table named ResData that is the database of available houses that I need to have it search. I can get it to do one search but I can't get it to repeat for each person and email them the results.
what do you suggest?
thanks for the response. I got a simple one of these working using that Mail Processor but this next one is too difficult for it to handle.
here is my latest project
I am building a site for a real estate company and they want the ability for visitors to record their search criteria and and have the server run that criteria every night and email them if there are listings.
Currently now I have I form online where they insert the search criteria (Price Range High, Price range Low, bed, bath, square footage, City and House Type) and their email address into a table named SavedSearchCriteria. I got that part working great. Now I need to have it. Then I have a table named ResData that is the database of available houses that I need to have it search. I can get it to do one search but I can't get it to repeat for each person and email them the results.
what do you suggest?
Replied 25 Oct 2004 17:47:11
25 Oct 2004 17:47:11 Lee Diggins replied:
Hi Colin
Post the code you have so far, probably just need another loop.
Digga
Sharing Knowledge Saves Valuable Time!!!
Post the code you have so far, probably just need another loop.
Digga
Sharing Knowledge Saves Valuable Time!!!
Replied 25 Oct 2004 18:03:19
25 Oct 2004 18:03:19 colin hart replied:
thanks again
here is the code that writes the results to the page. I am lost on the email part too as I can only make it work once, everytime I try to do a repart it does
here he the code
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="../Connections/RemaxIntranetMLS.asp" -->
<%
Dim rsSearchCriteria__MMColParam
rsSearchCriteria__MMColParam = "1"
If (Request("MM_EmptyValue" <> "" Then
rsSearchCriteria__MMColParam = Request("MM_EmptyValue"
End If
%>
<%
Dim rsSearchCriteria
Dim rsSearchCriteria_numRows
Set rsSearchCriteria = Server.CreateObject("ADODB.Recordset"
rsSearchCriteria.ActiveConnection = MM_RemaxIntranetMLS_STRING
rsSearchCriteria.Source = "SELECT ID, UserID, ImputDate, City, Type, PriceLow, PriceHigh, Bed, Bath, Sqft, name, status, email, fullName FROM dbo.SavedSearchCriteria WHERE status = '" + Replace(rsSearchCriteria__MMColParam, "'", "''" + "' ORDER BY ID ASC"
rsSearchCriteria.CursorType = 0
rsSearchCriteria.CursorLocation = 2
rsSearchCriteria.LockType = 1
rsSearchCriteria.Open()
rsSearchCriteria_numRows = 0
%>
<%
Dim rsPropSearch__MMColParam
rsPropSearch__MMColParam = "%"
If (rsSearchCriteria("City" <> "" Then
rsPropSearch__MMColParam = rsSearchCriteria("City"
End If
%>
<%
Dim rsPropSearch__MMColParam1
rsPropSearch__MMColParam1 = "1"
If (rsSearchCriteria("PriceLow" <> "" Then
rsPropSearch__MMColParam1 = rsSearchCriteria("PriceLow"
End If
%>
<%
Dim rsPropSearch__MMColParam2
rsPropSearch__MMColParam2 = "1"
If (rsSearchCriteria("PriceHigh" <> "" Then
rsPropSearch__MMColParam2 = rsSearchCriteria("PriceHigh"
End If
%>
<%
Dim rsPropSearch__MMColParam3
rsPropSearch__MMColParam3 = "%"
If (rsSearchCriteria("Type" <> "" Then
rsPropSearch__MMColParam3 = rsSearchCriteria("Type"
End If
%>
<%
Dim rsPropSearch__MMColParam4
rsPropSearch__MMColParam4 = "1"
If (rsSearchCriteria("Bed" <> "" Then
rsPropSearch__MMColParam4 = rsSearchCriteria("Bed"
End If
%>
<%
Dim rsPropSearch__MMColParam5
rsPropSearch__MMColParam5 = "1"
If (rsSearchCriteria("Bath" <> "" Then
rsPropSearch__MMColParam5 = rsSearchCriteria("Bath"
End If
%>
<%
Dim rsPropSearch
Dim rsPropSearch_numRows
Set rsPropSearch = Server.CreateObject("ADODB.Recordset"
rsPropSearch.ActiveConnection = MM_RemaxIntranetMLS_STRING
rsPropSearch.Source = "SELECT dbo.exp_Member.FullName, dbo.ResData.AgentList, dbo.ResData.MLSNum, dbo.ResData.ListPrice, dbo.ResData.Beds, dbo.ResData.BathsTotal, dbo.ResData.SqFtTotal, dbo.ResData.YearBuilt, dbo.ResData.StreetNum, dbo.ResData.StreetName, dbo.ResData.Remarks, dbo.ResData.City, dbo.ResData.PropType FROM dbo.exp_Member INNER JOIN dbo.ResData ON dbo.exp_Member.PubID = dbo.ResData.AgentList WHERE (dbo.ResData.ListPrice >= '" + Replace(rsPropSearch__MMColParam1, "'", "''" + "' AND dbo.ResData.ListPrice <= '" + Replace(rsPropSearch__MMColParam2, "'", "''" + "') AND dbo.ResData.City = '" + Replace(rsPropSearch__MMColParam, "'", "''" + "' AND (dbo.ResData.ListStatus = 'ACT' OR dbo.ResData.ListStatus = 'BACK') AND dbo.ResData.PropSubType = '" + Replace(rsPropSearch__MMColParam3, "'", "''" + "' AND dbo.ResData.Beds >= '" + Replace(rsPropSearch__MMColParam4, "'", "''" + "' AND dbo.ResData.BathsTotal >= '" + Replace(rsPropSearch__MMColParam5, "'", "''" + "' AND ListDate >=GETDATE()-2 ORDER BY ListPrice DESC"
rsPropSearch.CursorType = 3
rsPropSearch.CursorLocation = 3
rsPropSearch.LockType = 1
rsPropSearch.Open()
rsPropSearch_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = -1
Repeat1__index = 0
rsPropSearch_numRows = rsPropSearch_numRows + Repeat1__numRows
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
<p>Dear <%=(rsSearchCriteria.Fields.Item("fullName".Value)%></p>
<table width="100%" border="0" cellspacing="1" cellpadding="1">
<tr>
<td width="27%">Address</td>
<td width="16%">City</td>
<td width="14%">Beds</td>
<td width="30%">baths</td>
<td width="13%">Sq Ft </td>
</tr>
<%
While ((Repeat1__numRows <> 0) AND (NOT rsPropSearch.EOF))
%>
<tr>
<td><%=(rsPropSearch.Fields.Item("StreetNum".Value)%><img src="../spacer.gif" width="1" height="1"><%=(rsPropSearch.Fields.Item("StreetName".Value)%></td>
<td><%=(rsPropSearch.Fields.Item("City".Value)%></td>
<td><%=(rsPropSearch.Fields.Item("Beds".Value)%></td>
<td><%=(rsPropSearch.Fields.Item("BathsTotal".Value)%></td>
<td><%=(rsPropSearch.Fields.Item("SqFtTotal".Value)%></td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsPropSearch.MoveNext()
Wend
%>
</table>
<p>thanks </p>
<p>RE/MAX Real Estate </p>
</body>
</html>
<%
rsSearchCriteria.Close()
Set rsSearchCriteria = Nothing
%>
<%
rsPropSearch.Close()
Set rsPropSearch = Nothing
%>
here is the code that writes the results to the page. I am lost on the email part too as I can only make it work once, everytime I try to do a repart it does
here he the code
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="../Connections/RemaxIntranetMLS.asp" -->
<%
Dim rsSearchCriteria__MMColParam
rsSearchCriteria__MMColParam = "1"
If (Request("MM_EmptyValue" <> "" Then
rsSearchCriteria__MMColParam = Request("MM_EmptyValue"
End If
%>
<%
Dim rsSearchCriteria
Dim rsSearchCriteria_numRows
Set rsSearchCriteria = Server.CreateObject("ADODB.Recordset"
rsSearchCriteria.ActiveConnection = MM_RemaxIntranetMLS_STRING
rsSearchCriteria.Source = "SELECT ID, UserID, ImputDate, City, Type, PriceLow, PriceHigh, Bed, Bath, Sqft, name, status, email, fullName FROM dbo.SavedSearchCriteria WHERE status = '" + Replace(rsSearchCriteria__MMColParam, "'", "''" + "' ORDER BY ID ASC"
rsSearchCriteria.CursorType = 0
rsSearchCriteria.CursorLocation = 2
rsSearchCriteria.LockType = 1
rsSearchCriteria.Open()
rsSearchCriteria_numRows = 0
%>
<%
Dim rsPropSearch__MMColParam
rsPropSearch__MMColParam = "%"
If (rsSearchCriteria("City" <> "" Then
rsPropSearch__MMColParam = rsSearchCriteria("City"
End If
%>
<%
Dim rsPropSearch__MMColParam1
rsPropSearch__MMColParam1 = "1"
If (rsSearchCriteria("PriceLow" <> "" Then
rsPropSearch__MMColParam1 = rsSearchCriteria("PriceLow"
End If
%>
<%
Dim rsPropSearch__MMColParam2
rsPropSearch__MMColParam2 = "1"
If (rsSearchCriteria("PriceHigh" <> "" Then
rsPropSearch__MMColParam2 = rsSearchCriteria("PriceHigh"
End If
%>
<%
Dim rsPropSearch__MMColParam3
rsPropSearch__MMColParam3 = "%"
If (rsSearchCriteria("Type" <> "" Then
rsPropSearch__MMColParam3 = rsSearchCriteria("Type"
End If
%>
<%
Dim rsPropSearch__MMColParam4
rsPropSearch__MMColParam4 = "1"
If (rsSearchCriteria("Bed" <> "" Then
rsPropSearch__MMColParam4 = rsSearchCriteria("Bed"
End If
%>
<%
Dim rsPropSearch__MMColParam5
rsPropSearch__MMColParam5 = "1"
If (rsSearchCriteria("Bath" <> "" Then
rsPropSearch__MMColParam5 = rsSearchCriteria("Bath"
End If
%>
<%
Dim rsPropSearch
Dim rsPropSearch_numRows
Set rsPropSearch = Server.CreateObject("ADODB.Recordset"
rsPropSearch.ActiveConnection = MM_RemaxIntranetMLS_STRING
rsPropSearch.Source = "SELECT dbo.exp_Member.FullName, dbo.ResData.AgentList, dbo.ResData.MLSNum, dbo.ResData.ListPrice, dbo.ResData.Beds, dbo.ResData.BathsTotal, dbo.ResData.SqFtTotal, dbo.ResData.YearBuilt, dbo.ResData.StreetNum, dbo.ResData.StreetName, dbo.ResData.Remarks, dbo.ResData.City, dbo.ResData.PropType FROM dbo.exp_Member INNER JOIN dbo.ResData ON dbo.exp_Member.PubID = dbo.ResData.AgentList WHERE (dbo.ResData.ListPrice >= '" + Replace(rsPropSearch__MMColParam1, "'", "''" + "' AND dbo.ResData.ListPrice <= '" + Replace(rsPropSearch__MMColParam2, "'", "''" + "') AND dbo.ResData.City = '" + Replace(rsPropSearch__MMColParam, "'", "''" + "' AND (dbo.ResData.ListStatus = 'ACT' OR dbo.ResData.ListStatus = 'BACK') AND dbo.ResData.PropSubType = '" + Replace(rsPropSearch__MMColParam3, "'", "''" + "' AND dbo.ResData.Beds >= '" + Replace(rsPropSearch__MMColParam4, "'", "''" + "' AND dbo.ResData.BathsTotal >= '" + Replace(rsPropSearch__MMColParam5, "'", "''" + "' AND ListDate >=GETDATE()-2 ORDER BY ListPrice DESC"
rsPropSearch.CursorType = 3
rsPropSearch.CursorLocation = 3
rsPropSearch.LockType = 1
rsPropSearch.Open()
rsPropSearch_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = -1
Repeat1__index = 0
rsPropSearch_numRows = rsPropSearch_numRows + Repeat1__numRows
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
<p>Dear <%=(rsSearchCriteria.Fields.Item("fullName".Value)%></p>
<table width="100%" border="0" cellspacing="1" cellpadding="1">
<tr>
<td width="27%">Address</td>
<td width="16%">City</td>
<td width="14%">Beds</td>
<td width="30%">baths</td>
<td width="13%">Sq Ft </td>
</tr>
<%
While ((Repeat1__numRows <> 0) AND (NOT rsPropSearch.EOF))
%>
<tr>
<td><%=(rsPropSearch.Fields.Item("StreetNum".Value)%><img src="../spacer.gif" width="1" height="1"><%=(rsPropSearch.Fields.Item("StreetName".Value)%></td>
<td><%=(rsPropSearch.Fields.Item("City".Value)%></td>
<td><%=(rsPropSearch.Fields.Item("Beds".Value)%></td>
<td><%=(rsPropSearch.Fields.Item("BathsTotal".Value)%></td>
<td><%=(rsPropSearch.Fields.Item("SqFtTotal".Value)%></td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsPropSearch.MoveNext()
Wend
%>
</table>
<p>thanks </p>
<p>RE/MAX Real Estate </p>
</body>
</html>
<%
rsSearchCriteria.Close()
Set rsSearchCriteria = Nothing
%>
<%
rsPropSearch.Close()
Set rsPropSearch = Nothing
%>
Replied 25 Oct 2004 18:28:51
25 Oct 2004 18:28:51 Lee Diggins replied:
Can you post your email code too, I thought you got one going?
Digga
Sharing Knowledge Saves Valuable Time!!!
Digga
Sharing Knowledge Saves Valuable Time!!!
Replied 25 Oct 2004 18:41:21
25 Oct 2004 18:41:21 colin hart replied:
my bad, I gave you the wrong page
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="../Connections/RemaxIntranetMLS.asp" -->
<%
Dim rsSearchCriteria__MMColParam
rsSearchCriteria__MMColParam = "1"
If (Request("MM_EmptyValue" <> "" Then
rsSearchCriteria__MMColParam = Request("MM_EmptyValue"
End If
%>
<%
Dim rsSearchCriteria
Dim rsSearchCriteria_numRows
Set rsSearchCriteria = Server.CreateObject("ADODB.Recordset"
rsSearchCriteria.ActiveConnection = MM_RemaxIntranetMLS_STRING
rsSearchCriteria.Source = "SELECT ID, UserID, ImputDate, City, Type, PriceLow, PriceHigh, Bed, Bath, Sqft, name, status, email, fullName FROM dbo.SavedSearchCriteria WHERE status = '" + Replace(rsSearchCriteria__MMColParam, "'", "''" + "' ORDER BY ID ASC"
rsSearchCriteria.CursorType = 0
rsSearchCriteria.CursorLocation = 2
rsSearchCriteria.LockType = 1
rsSearchCriteria.Open()
rsSearchCriteria_numRows = 0
%>
<%
Dim rsPropSearch__MMColParam
rsPropSearch__MMColParam = "%"
If (rsSearchCriteria("City" <> "" Then
rsPropSearch__MMColParam = rsSearchCriteria("City"
End If
%>
<%
Dim rsPropSearch__MMColParam1
rsPropSearch__MMColParam1 = "1"
If (rsSearchCriteria("PriceLow" <> "" Then
rsPropSearch__MMColParam1 = rsSearchCriteria("PriceLow"
End If
%>
<%
Dim rsPropSearch__MMColParam2
rsPropSearch__MMColParam2 = "1"
If (rsSearchCriteria("PriceHigh" <> "" Then
rsPropSearch__MMColParam2 = rsSearchCriteria("PriceHigh"
End If
%>
<%
Dim rsPropSearch__MMColParam3
rsPropSearch__MMColParam3 = "%"
If (rsSearchCriteria("Type" <> "" Then
rsPropSearch__MMColParam3 = rsSearchCriteria("Type"
End If
%>
<%
Dim rsPropSearch__MMColParam4
rsPropSearch__MMColParam4 = "1"
If (rsSearchCriteria("Bed" <> "" Then
rsPropSearch__MMColParam4 = rsSearchCriteria("Bed"
End If
%>
<%
Dim rsPropSearch__MMColParam5
rsPropSearch__MMColParam5 = "1"
If (rsSearchCriteria("Bath" <> "" Then
rsPropSearch__MMColParam5 = rsSearchCriteria("Bath"
End If
%>
<%
Dim rsPropSearch
Dim rsPropSearch_numRows
Set rsPropSearch = Server.CreateObject("ADODB.Recordset"
rsPropSearch.ActiveConnection = MM_RemaxIntranetMLS_STRING
rsPropSearch.Source = "SELECT dbo.exp_Member.FullName, dbo.ResData.AgentList, dbo.ResData.MLSNum, dbo.ResData.ListPrice, dbo.ResData.Beds, dbo.ResData.BathsTotal, dbo.ResData.SqFtTotal, dbo.ResData.YearBuilt, dbo.ResData.StreetNum, dbo.ResData.StreetName, dbo.ResData.Remarks, dbo.ResData.City, dbo.ResData.PropType FROM dbo.exp_Member INNER JOIN dbo.ResData ON dbo.exp_Member.PubID = dbo.ResData.AgentList WHERE (dbo.ResData.ListPrice >= '" + Replace(rsPropSearch__MMColParam1, "'", "''" + "' AND dbo.ResData.ListPrice <= '" + Replace(rsPropSearch__MMColParam2, "'", "''" + "') AND dbo.ResData.City = '" + Replace(rsPropSearch__MMColParam, "'", "''" + "' AND (dbo.ResData.ListStatus = 'ACT' OR dbo.ResData.ListStatus = 'BACK') AND dbo.ResData.PropSubType = '" + Replace(rsPropSearch__MMColParam3, "'", "''" + "' AND dbo.ResData.Beds >= '" + Replace(rsPropSearch__MMColParam4, "'", "''" + "' AND dbo.ResData.BathsTotal >= '" + Replace(rsPropSearch__MMColParam5, "'", "''" + "' AND ListDate >=GETDATE()-2 ORDER BY ListPrice DESC"
rsPropSearch.CursorType = 3
rsPropSearch.CursorLocation = 3
rsPropSearch.LockType = 1
rsPropSearch.Open()
rsPropSearch_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = -1
Repeat1__index = 0
rsPropSearch_numRows = rsPropSearch_numRows + Repeat1__numRows
%>
<%
'***Insert the ASP mail after the Insert Record
'***insert returns to this page, so the form variables are available
Dim Body
Set Mailer = Server.CreateObject("SMTPsvg.Mailer"
Mailer.FromName = "Colin Hart"
Mailer.FromAddress= " "
Mailer.RemoteHost = "mail.homesoc.com"
Mailer.AddRecipient rsPropSearch.Fields.Item("fullName".Value, rsPropSearch.Fields.Item("email".Value 'MIS dept
Mailer.Subject = "Daily Mathces"
Body = "<p>Dear " & rsSearchCriteria.Fields.Item("fullName".Value & "</p>" & vbCRLF _
& "<table width=""100%"" border=""0"" cellspacing=""1"" cellpadding=""1""><tr><td width=""27%"">Address</td><td width=""16%"">City</td>" & vbCRLF _
& "<td width=""14%"">Beds</td><td width=""30%"">baths</td><td width=""13%"">Sq Ft </td></tr>" & vbCRLF _
& While ((Repeat1__numRows <> 0) AND (NOT rsPropSearch.EOF)) & vbCRLF _
& "<tr><td>" & rsPropSearch.Fields.Item("StreetNum".Value & "<img src=""../spacer.gif"" width=""1"" height=""1"">" & rsPropSearch.Fields.Item("StreetName".Value & vbCRLF _
& "</td><td>" & rsPropSearch.Fields.Item("City".Value & "</td><td>" & rsPropSearch.Fields.Item("Beds".Value & "</td><td>" & vbCRLF _
& rsPropSearch.Fields.Item("BathsTotal".Value & "</td><td>" & rsPropSearch.Fields.Item("SqFtTotal".Value & "</td></tr>" & vbCRLF _
& Repeat1__index=Repeat1__index+1 & vbCRLF _
& Repeat1__numRows=Repeat1__numRows-1 & vbCRLF _
& rsPropSearch.MoveNext() & vbCRLF _
& Wend & vbCRLF _
If (MM_editRedirectUrl <> "" Then
Response.Redirect(MM_editRedirectUrl)
End If
End If
End If
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
<p>Dear <%=(rsSearchCriteria.Fields.Item("fullName".Value)%></p>
<table width="100%" border="0" cellspacing="1" cellpadding="1">
<tr>
<td width="27%">Address</td>
<td width="16%">City</td>
<td width="14%">Beds</td>
<td width="30%">baths</td>
<td width="13%">Sq Ft </td>
</tr>
<%
While ((Repeat1__numRows <> 0) AND (NOT rsPropSearch.EOF))
%>
<tr>
<td><%=(rsPropSearch.Fields.Item("StreetNum".Value)%><img src="../spacer.gif" width="1" height="1"><%=(rsPropSearch.Fields.Item("StreetName".Value)%></td>
<td><%=(rsPropSearch.Fields.Item("City".Value)%></td>
<td><%=(rsPropSearch.Fields.Item("Beds".Value)%></td>
<td><%=(rsPropSearch.Fields.Item("BathsTotal".Value)%></td>
<td><%=(rsPropSearch.Fields.Item("SqFtTotal".Value)%></td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsPropSearch.MoveNext()
Wend
%>
</table>
<p>thanks </p>
<p>RE/MAX Real Estate </p>
</body>
</html>
<%
rsSearchCriteria.Close()
Set rsSearchCriteria = Nothing
%>
<%
rsPropSearch.Close()
Set rsPropSearch = Nothing
%>
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="../Connections/RemaxIntranetMLS.asp" -->
<%
Dim rsSearchCriteria__MMColParam
rsSearchCriteria__MMColParam = "1"
If (Request("MM_EmptyValue" <> "" Then
rsSearchCriteria__MMColParam = Request("MM_EmptyValue"
End If
%>
<%
Dim rsSearchCriteria
Dim rsSearchCriteria_numRows
Set rsSearchCriteria = Server.CreateObject("ADODB.Recordset"
rsSearchCriteria.ActiveConnection = MM_RemaxIntranetMLS_STRING
rsSearchCriteria.Source = "SELECT ID, UserID, ImputDate, City, Type, PriceLow, PriceHigh, Bed, Bath, Sqft, name, status, email, fullName FROM dbo.SavedSearchCriteria WHERE status = '" + Replace(rsSearchCriteria__MMColParam, "'", "''" + "' ORDER BY ID ASC"
rsSearchCriteria.CursorType = 0
rsSearchCriteria.CursorLocation = 2
rsSearchCriteria.LockType = 1
rsSearchCriteria.Open()
rsSearchCriteria_numRows = 0
%>
<%
Dim rsPropSearch__MMColParam
rsPropSearch__MMColParam = "%"
If (rsSearchCriteria("City" <> "" Then
rsPropSearch__MMColParam = rsSearchCriteria("City"
End If
%>
<%
Dim rsPropSearch__MMColParam1
rsPropSearch__MMColParam1 = "1"
If (rsSearchCriteria("PriceLow" <> "" Then
rsPropSearch__MMColParam1 = rsSearchCriteria("PriceLow"
End If
%>
<%
Dim rsPropSearch__MMColParam2
rsPropSearch__MMColParam2 = "1"
If (rsSearchCriteria("PriceHigh" <> "" Then
rsPropSearch__MMColParam2 = rsSearchCriteria("PriceHigh"
End If
%>
<%
Dim rsPropSearch__MMColParam3
rsPropSearch__MMColParam3 = "%"
If (rsSearchCriteria("Type" <> "" Then
rsPropSearch__MMColParam3 = rsSearchCriteria("Type"
End If
%>
<%
Dim rsPropSearch__MMColParam4
rsPropSearch__MMColParam4 = "1"
If (rsSearchCriteria("Bed" <> "" Then
rsPropSearch__MMColParam4 = rsSearchCriteria("Bed"
End If
%>
<%
Dim rsPropSearch__MMColParam5
rsPropSearch__MMColParam5 = "1"
If (rsSearchCriteria("Bath" <> "" Then
rsPropSearch__MMColParam5 = rsSearchCriteria("Bath"
End If
%>
<%
Dim rsPropSearch
Dim rsPropSearch_numRows
Set rsPropSearch = Server.CreateObject("ADODB.Recordset"
rsPropSearch.ActiveConnection = MM_RemaxIntranetMLS_STRING
rsPropSearch.Source = "SELECT dbo.exp_Member.FullName, dbo.ResData.AgentList, dbo.ResData.MLSNum, dbo.ResData.ListPrice, dbo.ResData.Beds, dbo.ResData.BathsTotal, dbo.ResData.SqFtTotal, dbo.ResData.YearBuilt, dbo.ResData.StreetNum, dbo.ResData.StreetName, dbo.ResData.Remarks, dbo.ResData.City, dbo.ResData.PropType FROM dbo.exp_Member INNER JOIN dbo.ResData ON dbo.exp_Member.PubID = dbo.ResData.AgentList WHERE (dbo.ResData.ListPrice >= '" + Replace(rsPropSearch__MMColParam1, "'", "''" + "' AND dbo.ResData.ListPrice <= '" + Replace(rsPropSearch__MMColParam2, "'", "''" + "') AND dbo.ResData.City = '" + Replace(rsPropSearch__MMColParam, "'", "''" + "' AND (dbo.ResData.ListStatus = 'ACT' OR dbo.ResData.ListStatus = 'BACK') AND dbo.ResData.PropSubType = '" + Replace(rsPropSearch__MMColParam3, "'", "''" + "' AND dbo.ResData.Beds >= '" + Replace(rsPropSearch__MMColParam4, "'", "''" + "' AND dbo.ResData.BathsTotal >= '" + Replace(rsPropSearch__MMColParam5, "'", "''" + "' AND ListDate >=GETDATE()-2 ORDER BY ListPrice DESC"
rsPropSearch.CursorType = 3
rsPropSearch.CursorLocation = 3
rsPropSearch.LockType = 1
rsPropSearch.Open()
rsPropSearch_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = -1
Repeat1__index = 0
rsPropSearch_numRows = rsPropSearch_numRows + Repeat1__numRows
%>
<%
'***Insert the ASP mail after the Insert Record
'***insert returns to this page, so the form variables are available
Dim Body
Set Mailer = Server.CreateObject("SMTPsvg.Mailer"
Mailer.FromName = "Colin Hart"
Mailer.FromAddress= " "
Mailer.RemoteHost = "mail.homesoc.com"
Mailer.AddRecipient rsPropSearch.Fields.Item("fullName".Value, rsPropSearch.Fields.Item("email".Value 'MIS dept
Mailer.Subject = "Daily Mathces"
Body = "<p>Dear " & rsSearchCriteria.Fields.Item("fullName".Value & "</p>" & vbCRLF _
& "<table width=""100%"" border=""0"" cellspacing=""1"" cellpadding=""1""><tr><td width=""27%"">Address</td><td width=""16%"">City</td>" & vbCRLF _
& "<td width=""14%"">Beds</td><td width=""30%"">baths</td><td width=""13%"">Sq Ft </td></tr>" & vbCRLF _
& While ((Repeat1__numRows <> 0) AND (NOT rsPropSearch.EOF)) & vbCRLF _
& "<tr><td>" & rsPropSearch.Fields.Item("StreetNum".Value & "<img src=""../spacer.gif"" width=""1"" height=""1"">" & rsPropSearch.Fields.Item("StreetName".Value & vbCRLF _
& "</td><td>" & rsPropSearch.Fields.Item("City".Value & "</td><td>" & rsPropSearch.Fields.Item("Beds".Value & "</td><td>" & vbCRLF _
& rsPropSearch.Fields.Item("BathsTotal".Value & "</td><td>" & rsPropSearch.Fields.Item("SqFtTotal".Value & "</td></tr>" & vbCRLF _
& Repeat1__index=Repeat1__index+1 & vbCRLF _
& Repeat1__numRows=Repeat1__numRows-1 & vbCRLF _
& rsPropSearch.MoveNext() & vbCRLF _
& Wend & vbCRLF _
If (MM_editRedirectUrl <> "" Then
Response.Redirect(MM_editRedirectUrl)
End If
End If
End If
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
<p>Dear <%=(rsSearchCriteria.Fields.Item("fullName".Value)%></p>
<table width="100%" border="0" cellspacing="1" cellpadding="1">
<tr>
<td width="27%">Address</td>
<td width="16%">City</td>
<td width="14%">Beds</td>
<td width="30%">baths</td>
<td width="13%">Sq Ft </td>
</tr>
<%
While ((Repeat1__numRows <> 0) AND (NOT rsPropSearch.EOF))
%>
<tr>
<td><%=(rsPropSearch.Fields.Item("StreetNum".Value)%><img src="../spacer.gif" width="1" height="1"><%=(rsPropSearch.Fields.Item("StreetName".Value)%></td>
<td><%=(rsPropSearch.Fields.Item("City".Value)%></td>
<td><%=(rsPropSearch.Fields.Item("Beds".Value)%></td>
<td><%=(rsPropSearch.Fields.Item("BathsTotal".Value)%></td>
<td><%=(rsPropSearch.Fields.Item("SqFtTotal".Value)%></td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsPropSearch.MoveNext()
Wend
%>
</table>
<p>thanks </p>
<p>RE/MAX Real Estate </p>
</body>
</html>
<%
rsSearchCriteria.Close()
Set rsSearchCriteria = Nothing
%>
<%
rsPropSearch.Close()
Set rsPropSearch = Nothing
%>
Replied 25 Oct 2004 22:11:14
25 Oct 2004 22:11:14 colin hart replied:
DIGGA
I think I got it
I just need to fine tune it, I had to fiddle with the nested repeats and it seems to write them, now I just need to get them emails.
thanks for the help
I think I got it
I just need to fine tune it, I had to fiddle with the nested repeats and it seems to write them, now I just need to get them emails.
thanks for the help
Replied 26 Oct 2004 11:01:29
26 Oct 2004 11:01:29 Lee Diggins replied:
No problem Colin, post back if you get stuck.
Digga
Sharing Knowledge Saves Valuable Time!!!
Digga
Sharing Knowledge Saves Valuable Time!!!