How to make an email notifier like google calendar?

I am using

  • asp.net mvc 2.0
  • C#
  • .NET 4.0
  • ms sql server 2005
  • iis 7.0

I want to make an email notifier system just like many sites have such as google. I want user to be able to set a reminder date and when that date is hit a email is sent to them.

I am not sure how to do this.

I heard of a couple ways but have not found any tutorials on how to do them.

  • Windows scheduler
  • through ms sql server (think sql server agent?)

With the windows scheduler I don't think it would work on a shared hosting environment. I would prefer if it did but if there is a big difference then I can live with out that ability.

I also want in the very near future to support SMS messages so the solution should be able to expand to work with that as well if possible.

Answers


This blog post presents a very effective (though somewhat 'hacky') solution to your problem that will work in a shared hosting environment. This is what Jeff used in StackOverflow to assign badges to users (I don't know if SO is still using it though).

For the code to actually send the email, you should look around the Internet since there are endless code examples on how to do that. One possible answer could be:

    public void SendEmail()
    {
        MailMessage loMsg = new MailMessage();

        loMsg.From = new MailAddress("from@domain.com");
        loMsg.To.Add(new MailAddress("to@domain.com"));
        loMsg.Subject = "Subject";
        loMsg.Body = "Email Body";


        var smtp = new SmtpClient
        {
            Host = "smtp.gmail.com",
            Port = 587,
            EnableSsl = true,
            DeliveryMethod = SmtpDeliveryMethod.Network,
            UseDefaultCredentials = false,
            Credentials = new System.Net.NetworkCredential("username", "password")
        };

        smtp.Send(loMsg);
        }

Take a look and see if it helps


@chobo2, you can use quartz.net to check for due tasks (say, every one minute) and take some action (like sending an email) when a task has a due date less than the current date and the task was not notified.

So you will have to have a due date property in your task and a bit indicating if it has been notified. Every minute, you run code that looks for tasks with due date less than or equal than the current date and for each of them you send a notification email. Then you mark the task as notified.

Regards.


Need Your Help

d3js force large number of nodes

d3.js visualization bigdata

pl. help me with this noob questions. I want to show a network with large number (70000) of nodes, and 2.1 million links in force layout. Looking for a good and scalable way to do this.

New to ASP.NET: Webforms vs MVC2

asp.net asp.net-mvc-2 webforms

I am new to ASP.NET Development and can't decide between developing with Webforms or MVC 2. Nevermind the pros and cons of each. I've seen mixed opinions of each. But which method would be the best...