c# - 发送带有送达报告的短信

标签 c# sms windows

我使用 GSM Communication Library (GSMComm)用于使用 GSM 调制解调器发送和接收 SMS。如何发送带有送达报告的短信?如何获取发送消息的状态?

最佳答案

您首先阅读 SIM 卡中的所有消息(因为状态报告消息作为短信从您使用的提供商发送回您的 SIM 卡)。
遍历这些消息并过滤掉状态消息。
您必须从您的手机中保存已发送短信的 ID data.Status.ToString() :

GsmCommMain comm = new GsmCommMain(port, baundRate, timeout);
//.... Other code may goes here
// Read all SMS messages from the storage
    DecodedShortMessage[] messages = comm.ReadMessages(PhoneMessageStatus.All, 
    PhoneStorageType.Sim );// Or PhoneStorageType.Phone
    foreach (DecodedShortMessage message in messages)
        {
          if (((SmsPdu)message.Data) is SmsStatusReportPdu)
          {
                //HERE WE'LL GET THE STATUS REPORT
                SmsStatusReportPdu data = (SmsStatusReportPdu)message.Data;
                //Recipient: data.RecipientAddress
                //Status: data.Status.ToString()
                //Timestamp: data.DischargeTime.ToString()
                //Message ref (ID of the sent sms from the mobile): data.MessageReference.ToString()


      }
    }

关于c# - 发送带有送达报告的短信,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4526539/

相关文章:

web-services - 如何接收短信 "from around the world"并存入网站数据库?

java - Delphi转java、soap delphi、短信发送

c++ - 我的内存在哪里?

python - 检测鼠标光标是否被任何其他应用程序隐藏或可见

c# - 为构建器类编写单元测试

c# - 系统托盘工具提示格式

ios 知道如何创建类似 "To:"短信或电子邮件字段的字段吗?

c# - 字符串到方法类

c# - 如何在c#中序列化64位枚举

c++ - 显示打开文件中的文本