如何在特定日期发送短信 [英] how to send sms on particular date

查看:105
本文介绍了如何在特定日期发送短信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的表中,有计划的日期,并且在我的.aspx页中有一个sendms()方法,该方法向用户发送短信.

如何在预定的日期触发方法sendms()?

请尽快回复我.

谢谢与问候
-----------------
SRIKANTH

In my table,there are scheduled dates & in my .aspx page there is a method sendsms() which sends sms to users.

How to fire the method sendsms() on that scheduled dates ?

Please reply me as soon as possible.

Thanks & Regards
-----------------
SRIKANTH

推荐答案

您可以在网站的反手中运行线程.该线程可以及时发送短信.或者您可以使用Windows服务,该服务也会及时发送短信.
Windows服务示例,如何发送短信.
You can run a thread in the backhand of the web site. This thread can send the sms in time. Or you can use windows service, which also will send the sms in time.
Example of a windows service, how you can send sms.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.IO;
using WindowsServiceDemo.Data;

namespace WindowsServiceDemo
{
    public partial class Service1 : ServiceBase
    {
        public Service1()
        {
            InitializeComponent();
        }
        System.Timers.Timer testTimer = new System.Timers.Timer();

        protected override void OnStart(string[] args)
        {
            testTimer.Enabled = true;
            testTimer.Interval = 1000;
            testTimer.Elapsed += new System.Timers.ElapsedEventHandler(testTimer_Elapsed);
        }
        private void testTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            /* you can check in the data base which sms should send & can send those sms */
        }

        protected override void OnStop()
        {
            testTimer.Enabled = false;
        }
    }
}


这篇关于如何在特定日期发送短信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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