I mean I would like to have a hard coded date on a page and then an email sent to an address, 1 day before the hard coded date.
I have reasearched into CDONTS and I have a email form working but how would I use this to automatically email someone dependant on the date?
Here is my code for the email form:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/ealert.asp" -->
<%
Dim rs_ealert
Dim rs_ealert_numRows
Set rs_ealert = Server.CreateObject("ADODB.Recordset")
rs_ealert.ActiveConnection = MM_ealert_STRING
rs_ealert.Source = "SELECT * FROM tbl_ealert"
rs_ealert.CursorType = 0
rs_ealert.CursorLocation = 2
rs_ealert.LockType = 1
rs_ealert.Open()
rs_ealert_numRows = 0
%>
<%
if Request.Form("FFSubmitted") = "yes" then
Dim BodyString
Dim objCDO
Dim RedirectURL
Dim FormFields
Dim arrFormFields
FormFields = "to~body~subject"
If FormFields <> "" Then
arrFormFields = split(FormFields,"~")
End If
Set objCDO = Server.CreateObject("CDONTS.NewMail")
objCDO.From = "eAlert@system.com"
objCDO.To = "anyone@hotmail.com"
objCDO.Cc = ""
objCDO.Bcc = ""
objCDO.Subject = "tester subject line"
BodyString = Replace("Tester body","~",chr(13) & chr(10) )& chr(13)
If FormFields <> "" Then
For Each item In arrFormFields
BodyString = BodyString & item & ": " & Request.Form(item) & chr(13)
Next
End If
objCDO.Body = BodyString
objCDO.BodyFormat = 1
objCDO.MailFormat = 1
objCDO.Send
Set objCDO = Nothing
RedirectURL = ""
If RedirectURL <> "" then
If Request.QueryString <> "" Then
response.redirect(RedirectURL & "?" & Request.QueryString)
else
response.redirect(RedirectURL)
end If
end if
end if
%>
<% MM_EditAction = CStr(Request("URL"))
If (Request.QueryString <> "") Then
MM_EditAction = MM_EditAction & "?" & Request.QueryString
End If
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "
<html>
<head>
<title>KHL Digital Magazine eAlerts</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
-->
</style>
<link href="css/Main_page.css" rel="stylesheet" type="text/css">
</head>
<body>
<form action="<%=MM_editAction%>" method="post" name="email_form" id="email_form">
<p>
<input name="to" type="text" id="to">
to </p>
<p>
<input name="body" type="text" id="body">
subject </p>
<p> <input name="subject" type="text" id="subject">
body</p>
<p>
<input type="submit" name="Submit" value="Submit">
</p>
<input type="hidden" name="FFSubmitted" value="yes">
</form>
</body>
</html>
<%
rs_ealert.Close()
Set rs_ealert = Nothing
%>