sending automated mail thro' ASP

liunx

Guest
Dear Friends I want to schedule automated mails thro' ASP at morming 8.00 and evening 8.00
How do i do it? I did some coding and wasted my whole day's time.
I wrote this in the global.asa file
Kindly help .




<SCRIPT LANGUAGE=vbscript runat=server>

sub sendme
femail = "[email protected]"
email = "[email protected]" ' , <!-- e --><a href="mailto:[email protected]">[email protected]</a><!-- e -->"
subj = "Website - User"

ipaddr = (request.servervariables("remote_addr"))
currdate = day(date) & "/" & month(date) & "/" & year(date)
currtime = time()

DIM myMail, html
html = "<br><pre>==========================================================="
html = html & "<br> <b>:: Microbit Information Systems ::</b>"
html = html & "<br>==========================================================="

html = html & "<br><b>I.P. Address</b>: " & ipaddr
html = html & "<br><b>View Date</b> : " & currdate
html = html & "<br><b>Viewed on </b> : " & currtime

Set myMail = Server.CreateObject("CDO.Message")
myMail.From= femail
myMail.To = email
myMail.Subject = subj
myMail.HtmlBody= html
myMail.Send

set mMail=nothing

If Err.Number <> 0 Then
Response.Write Err.Description
End IF
end sub
'-------------------------------------------------------------------
Sub smail
my_time = Hour(Now())
if my_time=8 then
sendme
end if

callmeagain
End Sub

'-------------------------------------------------------------------
sub callmeagain
'id = SetTimeout("smail", 3600000, "VBScript")
intTimerID=setTimeOut("smail",950, "VBScript")
end sub

'-------------------------------------------------------------------
sub application_onstart
smail
end sub


'Application_OnEnd Runs once when the web server shuts down

</SCRIPT>Hi Karthik,

I think maybe calling the asp page for achieving this is not good approach. You can create a .vbs (vbscript file) with pretty much the same code as your asp page in which also you are using vbscript. You can add this file to windows scheduler to run automatically and periodically.

But you will have to contact your webhosting company to add this to scheduler incase you dont have access to it.
 
Back
Top