且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

我的ASP.NET网站如何发送每周或每日电子邮件通知?

更新时间:2023-02-16 23:37:13





有几种方法可以做这件事,



1)使用SQL Server作业计划使用自动电子邮件通知



http://www.aspsnippets .com / Articles / Automated-Email-Notifications-using-SQL-Server-Job-Schedular.aspx [ ^ ]



2)使用窗口用C语言服务#



为此您可以创建一个窗口服务并将其安装在您的服务器上,在您的窗口服务中,您可以逻辑安排邮件发送



如需创建窗口服务,请参阅以下文档t $ / b
简单Windows服务示例



如果这有帮助那么请把这篇文章作为回答。



快乐编码



问候,

Renish Patel
Hi,

There are couple of ways to do this things,

1) Using Automated Email Notifications using SQL Server Job Schedular

http://www.aspsnippets.com/Articles/Automated-Email-Notifications-using-SQL-Server-Job-Schedular.aspx[^]

2) Using Window Service in C#

For that you can create a window service and install it at your server and in your window service you can logically schedule the mails to send

For creating window service refers the following Document
Simple Windows Service Sample

If this helps then please make this post as answered.

Happy Coding

Regards,
Renish Patel


另一种方法是编写一个控制台应用程序,然后在Windows调度程序中预订一个作业来触发控制台应用程序适当的日期和时间。



首先进行研究,弄清楚你是在没有GUI的服务器核心上运行,还是在最小GUI或完整GUI的服务器核心上运行。如果您没有运行带有shell的GUI来执行控制台应用程序,那么您需要一个更难编写的Windows服务。



我刚刚使用了上面的教程编写一个Windows服务来做你想要或需要做的事情,并发现它比文章表达的更难。但它几乎完成了,到目前为止一直很好。



C#:构建一个有用的,可扩展的.NET控制台应用程序模板,用于开发和测试 [ ^ ]
The other way is to write a console app, and then book a job in the windows scheduler to fire the console app at the appropriate date and time.

So do your research first, figure out if your running on a server core with no GUI, or Server core with minimum GUI or full GUI. If your not running a GUI with a shell to execute the console app, then you need a windows service, which is harder to write.

I just used the above tutorial to write a windows service to do the same thing you want or need to do, and found it more difficult than the article expresses. But it's almost done and so far so good.

C#: Building a Useful, Extensible .NET Console Application Template for Development and Testing[^]