%@ LANGUAGE="VBScript" %>
StoreFront Web Store Promo Mailer
<% If Request("promo") <> "customer" Then %>
<% ElseIf Request("promo") = "customer" Then %>
<%
StartDate = Request("Start_Date")&" 12:00:01 AM"
EndDate = Request("End_Date")&" 11:59:59 PM"
DSN_Name = Session("DSN_Name")
Set Connection = Server.CreateObject("ADODB.Connection")
Connection.Open DSN_Name
SQL = "SELECT MAIL_SERVER, MAIL_METHOD, PRIMARY_EMAIL, SECONDARY_EMAIL FROM admin"
Set RSAdmin = Connection.Execute(SQL)
MailServer = Trim(RSAdmin("MAIL_SERVER"))
MailMethod = Trim(RSAdmin("MAIL_METHOD"))
SendMail_C = "CustomerMail"
Set RSAdmin = nothing
SQLStmt = "SELECT Distinct(E_MAIL), NAME "
SQLStmt = SQLStmt & "FROM Customer WHERE ((ORDER_DATE >= "
SQLStmt = SQLStmt & "#" & StartDate & "#) AND "
SQLStmt = SQLStmt & "(ORDER_DATE <= #" & EndDate & "#)) "
Set RSMail = Connection.Execute(SQLStmt)
Do While NOT RSMail.EOF
CR = Chr(10) & Chr(13)
If InStr(RSMail("E_MAIL"),"@") Then
SUBJECT = Request("Subject")
PRIMARY = Request("Mail_From")
CUSTOMER = Trim(RSMail("E_Mail"))
BODY2 = "Dear " & RSMail("Name") & "," & CR & CR
BODY2 = BODY2 & Request("Mail_Message") & CR
LoadMail = DoMail
End If
RSMail.MoveNext
Loop
%>
Mail Report
| Mail Report |
The following message was sent to the customers listed below for the period <%= Request("Start_Date") %> through <%= Request("End_Date") %>. <%= Request("Mail_Message") %> |
<%
RSMail.MoveFirst
Do While NOT RSMail.EOF
%>
| <%= RSMail("Name") %> |
<%= RSMail("E_Mail") %> |
<%
RSMail.MoveNext
Loop
%>
<% End If %>