如何将短信从网络发送到手机? [英] how to send sms from web to mobile phone?

查看:89
本文介绍了如何将短信从网络发送到手机?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要c#代码才能将短信发送到手机。

i need c# code for send sms to mobile phone.

推荐答案

为什么要在多个论坛发帖?我在这里回复你: http ://www.codeproject.com/Messages/4511897/Re-How-to-send-SMS-from-ASP-NET-application-to-mob.aspx [ ^ ]



下次,请选择一个最适合您问题的论坛并坚持下去。
Why post the same thing in multiple forums? I replied you here: http://www.codeproject.com/Messages/4511897/Re-How-to-send-SMS-from-ASP-NET-application-to-mob.aspx[^]

Next time, please select one forum that you find best for your question and stick to it.


你可以使用通过gsm调制解调器的串口通信和下面给出的代码将短信网络发送到移动设备。



you can send sms web to mobile using serial port communication via gsm modem and code in given below.

           sendsms sms = new sendsms(); // create object for class
            sms.mysms(txtmobnum.Text, TXTMSG.Text);


//send sms class

SerialPort SMSPort = new SerialPort(COM5, 9600, Parity.None, 8, StopBits.One);
    public void mysms(string mobile,string message)
    {
        string SerialIn = null;
        byte[] RXBuffer = new byte[SMSPort.ReadBufferSize + 1];

        if (!SMSPort.IsOpen)
        {
            SMSPort.Open();
            SMSPort.WriteLine("AT+CMGF=" + "1" + (char)(13));
            SMSPort.Read(RXBuffer, 0, SMSPort.ReadBufferSize);
            SerialIn = SerialIn + System.Text.Encoding.ASCII.GetString(RXBuffer);

            SMSPort.Write("AT+CMGS=" + "\"91" + mobile + "\"" + System.Environment.NewLine);
            SMSPort.Read(RXBuffer, 0, SMSPort.ReadBufferSize);
            SerialIn = SerialIn + System.Text.Encoding.ASCII.GetString(RXBuffer);

            SMSPort.Write(message+ (char)(26));
            SMSPort.Read(RXBuffer, 0, SMSPort.ReadBufferSize);
            SerialIn = SerialIn + System.Text.Encoding.ASCII.GetString(RXBuffer);
            SMSPort.Close();

        }
    }



已添加代码块[/ Edit]


Code block added[/Edit]


这篇关于如何将短信从网络发送到手机?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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