HOw i can send mail at 12:00 pm of every day in asp.net application ?

Last post 06-01-2009 11:11 PM by chetan.sarode. 11 replies.

Sort Posts:

  • HOw i can send mail at 12:00 pm of every day in asp.net application ?

    05-25-2009, 10:44 PM
    • Member
      37 point Member
    • suryabeniwal
    • Member since 07-29-2008, 12:31 PM
    • Chandigarh
    • Posts 27

    Hi, i wants to send mail to admin of the website at 12 pm of every day automatically  anybody plase help me .

    how is this possible get time of server and post the mail everyday ?

    please reply me 

    SURYA BENIWAL
  • Re: HOw i can send mail at 12:00 pm of every day in asp.net application ?

    05-25-2009, 11:49 PM
    • Member
      424 point Member
    • atiface
    • Member since 03-14-2003, 7:02 AM
    • Posts 71

    You can't achieve this through an asp.net application

    you will need to use a windows service. 

    create a windows service which runs at intervals of 5 mins. put code in the windows service which checks the system time and when it goest past 12:00 pm, it sends out emails.

     

    Dont forget to mark as answer if this post helped you.
    --------------------------
    No Fate but what we make.
  • Re: HOw i can send mail at 12:00 pm of every day in asp.net application ?

    05-26-2009, 11:13 PM

    Based on my understanding, you want to send mail message with specific time. Such as e-mail users once a month, or on their birthday, or to send you details every day about what went on in the database that day.

    Windows service is a good choice. Besides, you can achieve it by using SQLSever. The below link which can help you out.

    http://classicasp.aspfaq.com/email/how-do-i-send-e-mail-from-sql-server.html

    You can trigger the function of sending message mail in a month. Before sending, you can check his targets in this trigger. If he hasn't achieved it, you can send mail.

    This thread can help you. http://forums.asp.net/t/1202964.aspx

    The following links also will help you ...

    http://aspalliance.com/1087_Working_with_Windows_Services_in_NET.all

    http://www.developerfusion.co.uk/show/3441/2/

    http://montgomerysoftware.com/CreatingWindowsServiceInCSharp.aspx

    http://note2.industriousone.com/writing-windows-services-c

    http://www.dotnetclassic.com/post/Send-Email-With-AspNet.aspx

    Chetan Sarode
    Software Engineer,
    Approva Systems Pvt Ltd,
    Pune, India.
  • Re: HOw i can send mail at 12:00 pm of every day in asp.net application ?

    05-29-2009, 2:20 PM
    • Member
      8 point Member
    • tssarao
    • Member since 12-11-2007, 5:54 PM
    • Posts 4

     You can start a thread which handles sending the emails. The thread can be started when the application starts. Use Application_Start function in Global.asax to do so. Here is what your code will look like .. its not tested but will give you a fair idea of what I am talking about.

     

     public System.Threading.Thread emailSender = null;
            protected void Application_Start(object sender, EventArgs e)
            {
                emailSender = new System.Threading.Thread(
                    new System.Threading.ThreadStart(RunEmailSender));
                emailSender.Start();
            }
            private void RunEmailSender()
            {
                // Always keep running.
                while (true)
                {
                    System.Threading.Thread.Sleep(60000);
                    try
                    {
                        SendEmails();
                    }
                    catch (Exception ex)
                    {
                        // Log any exceptions here
                    }
                }
            }

    private void SendEmails()
            {
     
            }

  • Re: HOw i can send mail at 12:00 pm of every day in asp.net application ?

    05-29-2009, 2:30 PM
    • All-Star
      59,185 point All-Star
    • mudassarkhan
    • Member since 02-28-2008, 5:28 AM
    • Mumbai, India
    • Posts 10,483
    • TrustedFriends-MVPs

    Refer my article

    http://www.aspsnippets.com/post/2009/03/08/Automated-Email-Notifications-using-SQL-Server-Job-Schedular.aspx

    I have explained an easy way to achieve it using job schedular

  • Re: HOw i can send mail at 12:00 pm of every day in asp.net application ?

    05-29-2009, 2:36 PM
    • Member
      8 point Member
    • tssarao
    • Member since 12-11-2007, 5:54 PM
    • Posts 4

     Your solution works well when you can use SQL Server ofcourse. I offered a pure .Net solution. Not only sending emails, threading solution can be used to implement other behind the scene processes like cleaning cache, dealing with filesystem etc.

    Thanks for the SQL Server emailing solution though.

    Regards

    Tajinder Sarao

  • Re: HOw i can send mail at 12:00 pm of every day in asp.net application ?

    05-29-2009, 2:50 PM
    • All-Star
      59,185 point All-Star
    • mudassarkhan
    • Member since 02-28-2008, 5:28 AM
    • Mumbai, India
    • Posts 10,483
    • TrustedFriends-MVPs

    tssarao:

    Your solution works well when you can use SQL Server ofcourse. I offered a pure .Net solution. Not only sending emails, threading solution can be used to implement other behind the scene processes like cleaning cache, dealing with filesystem etc.

    Thanks for the SQL Server emailing solution though.

    Regards

    Tajinder Sarao

    First of all your solution is really bad idea since it will affect website's performance Scheduling should never done on a website it should either be done through windows service or using SQL Job schedular and in that too SQL Server job schedular is the best since shared hosting does not allow windows services. Pure .Net solution ? What that means MS SQL server Job Schedular handles quite cleanly against the solution you have provided

  • Re: HOw i can send mail at 12:00 pm of every day in asp.net application ?

    05-29-2009, 3:49 PM
    • Member
      8 point Member
    • tssarao
    • Member since 12-11-2007, 5:54 PM
    • Posts 4
    Thanks
  • Re: HOw i can send mail at 12:00 pm of every day in asp.net application ?

    05-31-2009, 11:13 PM

    Can you tell me, whether provided links are helpful to you

    Chetan Sarode
    Software Engineer,
    Approva Systems Pvt Ltd,
    Pune, India.
  • Re: HOw i can send mail at 12:00 pm of every day in asp.net application ?

    06-01-2009, 12:32 AM
    • Member
      37 point Member
    • suryabeniwal
    • Member since 07-29-2008, 12:31 PM
    • Chandigarh
    • Posts 27

    Thanks everybody for help me

    i have done this task by using batch file and set the scheduler u can sent mail any time which u set in the scheduler ..............
    SURYA BENIWAL
  • Re: HOw i can send mail at 12:00 pm of every day in asp.net application ?

    06-01-2009, 12:33 AM
    • Member
      37 point Member
    • suryabeniwal
    • Member since 07-29-2008, 12:31 PM
    • Chandigarh
    • Posts 27

     Thanks dear

    SURYA BENIWAL
  • Re: HOw i can send mail at 12:00 pm of every day in asp.net application ?

    06-01-2009, 11:11 PM

    Please mark the answer, so it will help for other people

    Chetan Sarode
    Software Engineer,
    Approva Systems Pvt Ltd,
    Pune, India.
Page 1 of 1 (12 items)