比如说 每天00:00搜索一遍数据库
如果DateTime.Now == 用户生日
自动给其发邮件
(以前没做过 求详细思路 最好有个简单的例子--〉有中文注释更佳)是不是要用线程?
如果是怎么定义这个线程?
怎么在00:00启用这个线程??请大虾帮忙
:)
如果DateTime.Now == 用户生日
自动给其发邮件
(以前没做过 求详细思路 最好有个简单的例子--〉有中文注释更佳)是不是要用线程?
如果是怎么定义这个线程?
怎么在00:00启用这个线程??请大虾帮忙
:)
调试欢乐多
protected void Page_Load(object sender, EventArgs e)
{ this.Timer1.Enabled = true;
this.Timer1.Interval = 1000;
}
protected void Timer1_Tick(object sender, EventArgs e)
{
string CurrTime = System.DateTime.Now.ToString("hh:mm:ss");
if (CurrTime == "11:00:00")
{
System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage("from", "to", "测试定时", "测试定时发邮件");
System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient("smtp.163.com");
client.Credentials = new System.Net.NetworkCredential("name", "password");
try
{
client.Send(message);
}
catch (Exception ex)
{
SQLHelper.CreateErrorMsg(ex.Message);
}
}
}
3楼的--〉如果网站有许多站点(比如说要分网通的,电信的)那么用户就有可能收到两个相同的邮件
所以我感觉写成winform程序 不过
具体怎么写 还是没思路...
开始操作
}