Click to See Complete Forum and Search --> : Scheduled task with ASP
telmessos
05-05-2006, 08:15 AM
Hi all,
I have a website where people add/edit/delete products. I created a database table for logging additions, deletions and changes. I need to find a way to create an email message at a certain time of the day and send this email to the chosen email addresses.
I don't know VB programming so I can not make an EXE file for the scheduled tasks of my server.
Can anybody suggest an alternative way if there is one?
Thanks
Ceyhun
candelbc
05-05-2006, 08:43 AM
Some Hosting companies have the ability to kick off specific timed events, but for the most part, it's not possible thru ASP code.
What I have done is write an ASP page that does the maintenance tasks I do on a weekly level. Then I setup the Microsoft Task Scheduler to kick off that web page weekly.. That works for me..
Hope this helps..
lmf232s
05-05-2006, 08:46 AM
you can create a windows scheduled task.
Create a txt file and rename it w/ a .vbs extension instead of an .exe
Now open your .vbs file and you can do all your coding in here. Just think of it like making an asp page but you wont use any <% %>.
Here is some sample code from a .vbs file that i run to do emails. Youll see that its no different than an .asp page.
'SAVE TO THE DATABASE
strConnection = "Provider=sqloledb;Data Source=?;Initial Catalog=?;USER ID=?;PASSWORD=?;"
set objConn = CreateObject("ADODB.Connection")
objConn.Open strConnection
Set objRS = CreateObject("ADODB.Recordset")
SQL = "INSERT INTO BUSTED(CUR_DATE, COMPUTER_NAME, USER_NAME, APPLICATION, APP_NAME) " & _
"VALUES ('" & NOW() & "', '" & computerName & "', '" & samUser & "', '" & sExecutable & "', '" & sAPP & "')"
set objRS = objConn.execute(SQL)
'CREATE BODY OF EMAIL
body = Now() & "<BR>"
body = body & samUser & "<BR>"
body = body & computerName & "<BR>"
body = body & sAPP & "<BR>"
body = body & sExecutable
'SEND THE EMAIL
Set objNewMail = CreateObject("CDONTS.NewMail")
Const CdoMailFormatMime = 0
objNewMail.MailFormat = CdoMailFormatMime
'Send the new email
objNewMail.From = " "
objNewMail.To = " "
objNewMail.CC = " "
objNewMail.Bcc = " "
objNewMail.Subject = "Test Email"
objNewMail.BodyFormat = 0
objNewMail.MailFormat = 0
objNewMail.Body = Body
objNewMail.Send
kryptonboy22
05-08-2006, 11:00 PM
if you're using SQL for database, better search how stored proc works or yet start studying VB. learn how TIMER works in VB and it will solve your problem.