Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

email after 3 months

Status
Not open for further replies.

dom24

Programmer
Aug 5, 2004
218
GB
Is there a way of generating an email after a certain period of time?
What I want to do is allow the user to submit a form which they have completed, then 3 months later an email is sent to their manager to comment on their progress.
I'm using SQL server as the backend and so their details adn the time and data of submission will b e stored in there.
Thanks.
 
yes but i think u may have to use sql server job, in the job u can write ASP code (for sending email).

save the email as a record with the date it has to go and use SQL Server jobs...

Known is handfull, Unknown is worldfull
 
You have to specify a date in that though don't you, wherease I want it to take the data from a field in a database and run it 3 months after that date.
 
yes thats what i also mean, when the user presses submit (today) a record will be created with a date 3 months hence.

in SQL server u can execute a job(day wise/minute wise etc). in that job u can use VBScript where u can pass a sql like this:
select * from table where date="'"&date&"'"

on the day the job is run oit will give the current date so when the job runs 3 months from hence u can fire the CDONTS object in ur vbscript:
sql="select * from table where date="'"&date&"'"
rs.open sql,con 'will return mails to be sent today
loop through the records and send the mail, only difference between VBScript and asp is that in VBScript u cannot use server.createobject, u have to use just createobject().

Note: The sql srever must reside in the same server as IIS...


Known is handfull, Unknown is worldfull
 
If the form is on a page that is hit often, at least once daily) you can just right a script that looks for records that are more than three months old and send an email. This script would run every time the form is submitted (or you could even put the script on a home page that his hit more often) It might make it easier to add a field to say if an email has been sent to prevent sinding multiple to the same record)
 
I do something like that in a couple of sites... I have an application variable that is incremented every time a page is accessed. If the number of accesses reaches a certain number (depends on the popularity of the site), I reset it and check to see if it's been at least 12 hours since I last sent emails. If not then I do nothing, but if so I go ahead and send the emails as part of serving this page (asking the database for any "send dates" that are less than or equal to today that are still marked as unsent).

Note that if you have to send a ton of emails you'll want to increase the frequency of sending so you don't end up hanging that user too much.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top