定时发送邮件或定时做其他的操作

来源:百度知道 编辑:UC知道 时间:2024/06/20 15:05:11
我想定时给网站的会员定时发送一封邮件(每个星期左右)
我不要发邮件的代码啊 。。。。。
我要的是如何实现让程序每隔7天去执行某个操作啊
有点类似 setTimeout("save()",604800);save(){//发邮件操作}

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.Net.Mail;
using System.Media;
using System.Runtime.InteropServices;

namespace 发送邮件
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void btnOk_Click(object sender, EventArgs e)
{
SmtpClient c = new SmtpClient();
c.Port = 25;//服务器端口
c.Host = "smtp." + cboxMail1.Text.Trim() + ".com";//服务器地址
c.UseDefaultCredentials = false;
c.DeliveryMethod = SmtpDeliveryMethod.Network;//网络发送
c.Credentials = new NetworkCredential(txtSend .Text .Trim (), txtPwd .Text .Trim