如何使用c#.net从Windows应用程序发送短信? [英] How to send SMS from windows application using c#.net?

查看:72
本文介绍了如何使用c#.net从Windows应用程序发送短信?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用c#.net ???

I want to send sms to mobile from windows application using c#.net???

推荐答案

从Windows应用程序发送短信到移动设备有几种方式,两种方式: -



a)使用基于网络的短信服务提供商 - 通常您使用基于http的API向他们发送请求 - 您通常按短信发送的数量支付此服务



b)使用GPRS调制解调器 - 可能通过串行/ USB端口接口 - 您通常通过购买一个GPRS调制解调器,然后从SIM提供商收取SMS / SIM数据来支付费用
there are a few ways, two being :-

a) use a web based sms provider - typically you send them a request using a http based API - you typically pay for this service by volume of sms's sent

b) use a GPRS Modem - possibly via a Serial/USB port interface - you typically pay for this by purchasing a one-of GPRS modem, then SMS/SIM Data charges from the SIM provider


Following is one example to do this:-
















using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO.Ports;
using System.Threading;


namespace SMSWinApp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private SerialPort _serialPort;
        private void button1_Click(object sender, EventArgs e)
        {
            string number = textBox1.Text;
            string message = txtMessage.Text;




            //Replace "COM8"withcorresponding port name
           _serialPort = new SerialPort("COM8", 115200);


            Thread.Sleep(100);

            _serialPort.Open();

            Thread.Sleep(100);

            _serialPort.Write("AT+CMGF=1\r");

            Thread.Sleep(100);

            _serialPort.Write("AT+CMGS=\"" + number + "\"\r\n");

            Thread.Sleep(100);

            _serialPort.Write(message + "\x1A");

            Thread.Sleep(300);

            label1.Text = "Message sent !!";

            _serialPort.Close();
        }
    }
}


SO答案 [ ^ ]

http://www.notepage.net/ [ ^ ]

您必须使用第三方工具/ API集成到您的应用程序。

浏览上面的链接。

我跳这些文件可以帮到你。

谢谢

:)
SO Answers[^]
http://www.notepage.net/[^]
You have to use third party tool/API to be integrated to your application.
Go through the links above.
I hopw these documentations help you.
Thanks
:)


这篇关于如何使用c#.net从Windows应用程序发送短信?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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