简体   繁体   English

Azure Web 应用 SQL 电子邮件通知

[英]Azure Web App SQL Email Notifications

I'm just wondering what is the best (and most economical) way to do email notifications on an SQL database in Azure?我只是想知道在 Azure 中的 SQL 数据库上发送电子邮件通知的最佳(也是最经济的)方法是什么?

I've setup a web app and it uses an SQL database.我已经设置了一个网络应用程序,它使用了一个 SQL 数据库。 In that database there are a couple of tables with Expiry Dates in. I want to send an email to the owner of that record (and possibly others) when the expiry date is approaching so for example 1 month before, 2 weeks before, 1 week before, 3, 2, 1 days before and on expiry.在该数据库中,有几个带有到期日期的表。我想在到期日期临近时向该记录的所有者(可能还有其他人)发送一封电子邮件,例如 1 个月前、2 周前、1 周到期前、到期前 3、2、1 天。 Then also on a weekly basis after expiry date keep notifying it is expired.然后也在到期日后每周通知它已到期。

How would i do this?我该怎么做?

Thanks谢谢

[UPDATE] Just to clarify I've already setup an email client in my web app using SMTPClient. [更新] 只是为了澄清我已经使用 SMTPClient 在我的网络应用程序中设置了一个电子邮件客户端。 I'm looking how to setup the automated process to send such emails.我正在寻找如何设置自动过程来发送此类电子邮件。

Thanks谢谢

Using Email and Azure, the default choice is using SendGrid.使用电子邮件和 Azure,默认选择是使用 SendGrid。 And although SendGrid doesn't offer a Free pricing plan on their website anymore, you can choose the Free pricing tier when you create a SendGrid account through the Azure portal.尽管 SendGrid 不再在其网站上提供免费定价计划,但您可以在通过 Azure 门户创建 SendGrid 帐户时选择免费定价层。 It includes 25,000 emails/month.它包括 25,000 封电子邮件/月。

Have a look at this article on how to: How to Send Email Using SendGrid with Azure查看有关如何操作的文章: 如何使用 SendGrid 和 Azure 发送电子邮件

After this addition:添加后:

how to setup the automated process of sending those kind of notification emails?如何设置发送此类通知电子邮件的自动化过程?

I would say: have a look at running a WebJob at a specified interval.我会说:看看以指定的时间间隔运行 WebJob。 WebJobs come for free with Web Apps, and can be seen as old-fashioned cron jobs. WebJobs 随 Web Apps 免费提供,可被视为老式的 cron 作业。 Getting stuff from a database and sending out mails based on the information sounds like an excellent task for a WebJob.从数据库中获取内容并根据信息发送邮件对于 WebJob 来说听起来是一项出色的任务。

I would suggest you write a WebJob using the WebJobs SDK , since this helps in getting stuff up & running pretty fast.我建议您使用WebJobs SDK编写 WebJob,因为这有助于快速启动和运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM