如何使电子邮件通知像谷歌日历? [英] How to make an email notifier like google calendar?

查看:258
本文介绍了如何使电子邮件通知像谷歌日历?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用

  • 在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计划
  • 通过MS SQL服务器(认为SQL Server代理?)

随着Windows计划,我不认为它会工作一个共享的主机环境。我想preFER如果它这样做,但如果有一个很大的区别,然后我可以忍受了这种能力。

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.

推荐答案

本的博客文章 presents一个非常有效的(虽然有点'哈克')问题的解决方案,将工作在一个共享的主机环境。这是用在计算器杰夫指派徽章的用户(我不知道,如果是的话仍然使用它虽然)。

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).

对于code实际发送的邮件,你应该看看周围的互联网,因为有关于如何做到这一点无尽code的例子。一个可能的答案可能是:

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

这篇关于如何使电子邮件通知像谷歌日历?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆