Quartz定义一个邮件,在触发后触发aspx后12小时

时间:2017-10-27 17:44:37

标签: asp.net email quartz-scheduler quartz

我尝试添加一项功能,在您按下按钮后12小时向3个特定参考发送邮件,以便向联系人发送邮件(该部分已在工作)。我使用的是Quartz,但我不知道这是否有用。 sendMailEveryone()已经在工作(但它正在从特定页面中取值),但是我希望它能够在点击按钮后将这些值保存12小时(首先尝试10分钟)。

这是我的代码:

    void schedulerMail()
    {
        IScheduler scheduler = StdSchedulerFactory.GetDefaultScheduler();
        scheduler.Start();
        IJobDetail job1 = JobBuilder.Create<sendMailEveryone>().Build();
        ITrigger trigger1 = TriggerBuilder.Create()
    .WithIdentity("trigger1", "group1")
    .StartNow()
    .WithSimpleSchedule(x => x
        .WithIntervalInMinutes(10))
    .Build();
        scheduler.ScheduleJob(job1, trigger1);
    }

    protected void sendMailEveryone(ASF.HC.JobApplication.BO.Campo dbDatos) {
        String ref1Mail = dbDatos.GetKey("txtReference_mail1");
        String ref2Mail = dbDatos.GetKey("txtReference_mail2");
        String ref3Mail = dbDatos.GetKey("txtReference_mail3");
        String body = "linksssssssss";
        String title = "titulo del mail";
        BO.Messages mail = new BO.Messages();
        mail.refEmail(ref1Mail, title, body);
        mail.refEmail(ref2Mail, title, body);
        mail.refEmail(ref3Mail, title, body);

    }

0 个答案:

没有答案