Click here to Skip to main content
13,453,767 members (43,596 online)
Click here to Skip to main content
Add your own
alternative version


45 bookmarked
Posted 2 Jan 2010

Schedule Email Through ASP.NET or Schedule Tasks Using ASP.NET

, 2 Jan 2010
Rate this:
Please Sign up or sign in to vote.
Send schedule(automatic) emails through ASP.NET web application.


 In many web application we need to send schedule(automatic) emails and we schedule them.

  • Sends emails on a regular basis<o:p />
  • Send the message at daily, weekly, monthly or yearly intervals.<o:p />  
  For this, we normally used windows services or windows application.<o:p />

  But in a shared host environment you're out of luck for running these kind of application because you  don't  have access on a shared server.


We can perform scheduled job process through our ASP.NET web projects without buying dedicated servers.

1. No need to buying dedicated servers.
2. Perform scheduled job process through our ASP.NET web application. 

Using the code 

As we know the web server IIS is continuously running, we can add a timer in the application and the timer can manage all these activities.   

// Inside Global.ascx
void Application_Start(object sender, EventArgs e)
    // Code that runs on application startup
    System.Timers.Timer myTimer = new System.Timers.Timer();
    // Set the Interval to 5 seconds (5000 milliseconds).
    myTimer.Interval = 5000;
    myTimer.AutoReset = true;
    myTimer.Elapsed += new ElapsedEventHandler(myTimer_Elapsed);
    myTimer.Enabled = true;

public void myTimer_Elapsed(object source, System.Timers.ElapsedEventArgs e)
    // use your mailer code
    clsScheduleMail objScheduleMail = new clsScheduleMail();
// inside your class
 public void SendScheduleMail()
   // Write your send mail code here.
For more details, please refer to the uploaded code.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Samrat Banerjee
Software Developer (Senior)
India India
Hi, I am Samrat Banerjee from India.
I am a Software Engineer working in .net platform.
I love to explore new technologies.

You may also be interested in...


Comments and Discussions

QuestionSend Email at Specific Time ??? Pin
Member 1075879012-Nov-17 21:45
memberMember 1075879012-Nov-17 21:45 
QuestionHow many times it's send mail to user Pin
PallavSingh27-Jul-16 23:02
professionalPallavSingh27-Jul-16 23:02 
QuestionSame code but dosnt work Pin
vezo1124-Jun-14 5:21
membervezo1124-Jun-14 5:21 
QuestionVery Nice article ...... Pin
heemanshubhalla15-Feb-14 7:01
memberheemanshubhalla15-Feb-14 7:01 
AnswerRe: Very Nice article ...... Pin
Samrat Banerjee28-Feb-14 23:42
memberSamrat Banerjee28-Feb-14 23:42 
Question[My vote of 1] its not working i have tested on my shared hosting Pin
samiatcodeproject17-Sep-13 2:09
membersamiatcodeproject17-Sep-13 2:09 
GeneralMy vote of 5 Pin
Member 97250353-Jul-13 23:35
memberMember 97250353-Jul-13 23:35 
QuestionHow to send mail at specific time? Pin
Chanchal Purbia3-Mar-13 20:57
memberChanchal Purbia3-Mar-13 20:57 
GeneralMy vote of 1 Pin
hemantrautela29-Dec-12 2:55
memberhemantrautela29-Dec-12 2:55 
GeneralMy vote of 1 Pin
aspnet_regiis -i21-Nov-12 2:12
memberaspnet_regiis -i21-Nov-12 2:12 
GeneralMy vote of 5 Pin
jayantj13-Oct-12 3:20
memberjayantj13-Oct-12 3:20 
GeneralMy vote of 1 Pin
Member 92790763-Aug-12 5:27
memberMember 92790763-Aug-12 5:27 
GeneralMy vote of 5 Pin
tanweer akhtar29-Jun-12 0:33
membertanweer akhtar29-Jun-12 0:33 
GeneralMy vote of 5 Pin
Hari Chowdary13-Jun-12 22:56
groupHari Chowdary13-Jun-12 22:56 
Questionsend mail on cache item expires in Pin
pranaysoni007819-May-12 21:03
memberpranaysoni007819-May-12 21:03 
Questionhow to use this class file with database Pin
sathya.spidy1-Apr-12 20:53
membersathya.spidy1-Apr-12 20:53 
AnswerRe: how to use this class file with database Pin
Venkata Aditya Korada7-Sep-12 7:40
memberVenkata Aditya Korada7-Sep-12 7:40 
GeneralMy vote of 4 Pin
Richa.Net8-Nov-11 1:35
memberRicha.Net8-Nov-11 1:35 
QuestionNot Working Pin
Technoses8-Oct-11 1:31
groupTechnoses8-Oct-11 1:31 
GeneralHelp Required Pin
syed_developer31-Jan-10 1:38
membersyed_developer31-Jan-10 1:38 
General Pin
MoPhat4-Jan-10 1:11
memberMoPhat4-Jan-10 1:11 
GeneralRe: Pin
Member 11626297-Jan-10 17:03
memberMember 11626297-Jan-10 17:03 
GeneralMy vote of 1 Pin
Virendra Dugar3-Jan-10 22:55
memberVirendra Dugar3-Jan-10 22:55 
GeneralThanks but ! Pin
atarikg2-Jan-10 13:10
memberatarikg2-Jan-10 13:10 
GeneralRe: Thanks but ! Pin
Venkata Aditya Korada13-Sep-12 14:27
memberVenkata Aditya Korada13-Sep-12 14:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.180318.3 | Last Updated 2 Jan 2010
Article Copyright 2010 by Samrat Banerjee
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid