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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Daily automatic email service

Status
Not open for further replies.

SonJ

Programmer
Oct 24, 2002
166
0
0
GB
Hi,

I am building a system for which one of the requirements is to write an email notification service.

The way that it has to work, is that I need to find records that are more than 21 days old and still have an open action against them. Once I locate these records, I need to send an email to the person who entered the record to inform them that an action is required. This needs to be an automatic service with no user interaction. Ideally, this service will run on a daily basis.

Does anyone know how I can do this? Pointers, references would be much appreciated.

Thanks in advance.
SonD
 
use
if DateDiff("d", DateTime.Today(), record_date)> 21 then...
 
Hi,

I think I should have been clearer. I know how to retrieve the records and use the .NET mail component. What I need to know is can anyone advise me on how I can schedule the task to run on a daily basis.

SonD
 
SonD,

You can write the application as a "Console Application" or a "Windows App (.exe)". Then open a .bat file in text editor like notepad. Enter the command to execute the app. you just created. for example,

test.bat -> <path to the exe>

Using "add scheduled task", you can schedule to run test.bat file at regular interval (daily/weekly etc.)

HTH
 
you may want to also look at creating a windows service. there is a walk through that outlines how to create one. I used the walk through to design a service that emails an ops report every night to staff.

Jason Meckley
Database Analyst
WITF
 
jmeckley,

Thanks for the input. Do you have any references to where I can find a walkthrough which will help me to acheive this?

SonD
 
ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/vbcon/html/vbwlkwalkthroughcreatingwindowsserviceapplication.htm

this is the help link in VS.Net 2003. Once you compile the service you will need to install it one a server. I wrote a batch file to install/start it. (The second one will stop/uninstall it.)

Install_Service.bat
Code:
c:
cd\WINDOWS
cd microsoft.net
cd framework
cd v1.1.4322
installutil "[File Path to executable]"
net start  "[Name of Service]"
Uninstall_Service.bat
Code:
c:
cd\WINDOWS\microsoft.net\framework\v1.1.4322
installutil /u "[File Path to executable]"

Jason Meckley
Database Analyst
WITF
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top