定时自动发邮件(asp网站,空间服务器,jmail)

现在是用空间服务器,网站邮件系统是用jmail编写的
它有个缺陷就是不能定时自动发送邮件(如果设置一个网页24H挂在某电脑上,实现自动刷新还是可以自动发邮件,但这很不理想)
如何才可以实现定时自动发送邮件呢?
用asp以外的语言?但它能和asp网站共存嘛?
有其它类似于JMAIL的邮件系统能自动发送邮件?是什么呢?

1. 添加Global.asax文件
add-->web--> Global Application Class
2. 在Global.asax里添加代码
protected void Application_Start(object sender, EventArgs e)
{
System.Timers.Timer timer = new System.Timers.Timer(60000);
timer.Elapsed += new System.Timers.ElapsedEventHandler(Send);
timer.Start();
}

public void Send(object sender, System.Timers.ElapsedEventArgs e)
{

if (DateTime.Now.Minute == 20)
{
SendMail sm = new SendMail();
sm.SendEMail("[email protected]", "[email protected]", "[email protected]", "Auto Mail", "This is a auto amil!");

}

}
public void SendEMail(string To1, string CC1, string BC1, string Subject1, string Body1)
{
MailMessage msg = new MailMessage("[email protected]", To1);
msg.CC.Add(CC1);
msg.Bcc.Add(BC1);
msg.Subject = Subject1;
msg.Body = Body1;
msg.IsBodyHtml = true;
msg.Priority = MailPriority.High;
SmtpClient c = new SmtpClient("127.0.0.1");
c.Port = 25;
c.Send(msg);
}追问

能否稍微给点关键注释,
还有就是我在哪可以添加条件控制项,
eg:从数据库获取日期和空间服务器日期对比,到了某个特定日期就触发这个Global.asax
谢谢!!

温馨提示:答案为网友推荐,仅供参考
相似回答
大家正在搜