在特定时间自动发送电子邮件 [英] Automatic Email Seding at Particular Selected Time

查看:97
本文介绍了在特定时间自动发送电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在实施Web应用程序,在该应用程序中我将设置将有关任何事情的电子邮件发送给客户的特定时间.我将在插入客户详细信息时设置时间.如何使用应用程序自动将电子邮件发送给客户端.我正在用c#来实现asp.net.

问候,

Jeevan.

Hi all,

I am implementing web application where i will set the particular time to send email to the clients regarding any thing. I will set the time while inserting the client details. How can i send emails to the client using application automatically. I am implementing using asp.net with c#.

Regards,

Jeevan.

推荐答案

您不能在指定的时间使用ASP.NET自动发送它.您将需要某种类型的服务来执行此操作,或者,如果使用SQL Server,则需要创建一个SQL Job来执行此操作.
You can''t send it automatically at a specified time using ASP.NET. You will need some type of service to do this or, if using SQL Server, create a SQL Job to do so.


我认为您绝对可以做到,但是我必须警告您,这很麻烦,如果您关闭页面,则将无法使用.但是你可以做到的.

创建一个具有以下属性的类(我称其为"EmailToSend"):to/from/subject/body/whateverelse/,最后创建一个DateTime.

创建要发送的通用电子邮件列表:

List<emailtosend> Emails = new List<emailtosend>();</emailtosend></emailtosend>

用电子邮件填充列表,您甚至可以在同一页面上完成该操作,并使用DataGrid显示等待发送的电子邮件.

让页面上的计时器每分钟执行一次回发.回发事件触发一种方法,该方法将遍历集合并发送所有时间已过期的电子邮件.届时,您可以将其从队列中删除,或将其保留在顶部以为它们提供不同的颜色.

如果您真的想花哨的话,可以创建一个SQL数据库来保存电子邮件.现在您有了持久性(但是如果关闭页面,它仍然无法工作).

瑞安·麦克贝斯(Ryan McBeth)
I think you can definitely do it, but I have to warn you, this will be kludgy and it will not work if you close the page. But you can do it.

Create a class (I''d call it "EmailToSend") with the properties of : to/from/subject/body/whateverelse/ and finally, a DateTime.

Create a generic list of emails to send:

List<emailtosend> Emails = new List<emailtosend>();</emailtosend></emailtosend>

Fill the list up with emails, you could even do it on the same page and use a DataGrid to display the emails that are waiting to be sent.

Have a timer on the page execute a postback every minute. The postback event fires a method which will go through the collection and sends all of the emails who''s times have expired. At that point, you can remove them from the queue or keep them top give them a different color.

If you want to get really fancy, you could create a SQL database that will hold the emails. Now you have persistence (but it still won''t work if the page is closed).

Ryan McBeth


这篇关于在特定时间自动发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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