Hello,
I create an email alert to run daily to remind students renew their ID card every 90 days. If any student who meets this criteria will receive an email. The problem is that we can only run it from Monday to Friday. So, if any student who has expired date that falls on Saturday or Sunday of every week, he/she can't receive an alert, because we don't run this script on Weekends.
So, I think about calculating Mondays that include Saturdays and Sundays. (If Mondays Then Mondays + 2)
I am using ASP and SQL server.
Here is my script.
Can someone help me please?
Thanks.
Code:<% Set oRs = Server.CreateObject("adodb.recordset") strSQL = " select id, name, Email, expired_date "_ & " from tbl_students "_ & " where expired_date = DateAdd(Day, DateDiff(Day,0,GetDate())+90,0) and DateAdd(Day, DateDiff(Day,0,GetDate())+90,0) " oRs.Open strSQL, myConn Dim sid, sName, sexpired_date, NewMailObj, sMail, sBody, aEmail aEmail = "" if not oRs.eof then do until oRs.eof sMail = oRs("Email") sid = oRs("id") sName = oRs("Name") sexpired_date = oRs("expired_date") aEmail = aEmail & sMail & "," if len(spassportnumber) > 1 then Set NewMailObj = CreateObject("CDO.message") NewMailObj.From = "Student_ID_remind" NewMailObj.To = sMail NewMailObj.Subject = "ALERT – Student_ID_remind" NewMailObj.HTMLBody = "<em><strong>Please renew your student ID</strong></em>" & vbCrLf NewMailObj.Send End If oRs.MoveNext loop End If %>



Reply With Quote
Bookmarks