gpt4 book ai didi

c# - 如何在 GSMComm 库中连接长短信?

转载 作者:太空狗 更新时间:2023-10-29 22:57:52 25 4
gpt4 key购买 nike

这是我的代码:

根据这个page CreateConcatTextMessage 方法返回类型为 SmsSubmitPdu[] 的数组,但是,当我尝试使用 SendMessages 发送它时,我得到一个 MessageServiceError 500 。我错过了什么?

       SmsSubmitPdu[] pdu2;

try{
pdu2 = SmartMessageFactory.CreateConcatTextMessage("My name is Barry Allen. And I am the fastest man alive. When I was a child I saw my mother killed by something impossible. My father went to prison for her murder.", "+639234597676");
comm.SendMessages(pdu2);
}

catch (MessageServiceErrorException e500){
MessageBox.Show(e500.ToString(), "Information", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
catch (CommException e501){
MessageBox.Show(e501.ToString(), "Information", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}

最佳答案

您的代码应如下所示:

GsmCommMain comm=new GsmCommMain(/*Set your option here*/);

string txtMessage="your long message...";
string txtDestinationNumbers="your destination number";

//select unicode option by a checkBox or any other control
bool unicode = chkUnicode.Checked;

SmsSubmitPdu[] pdu = SmartMessageFactory.CreateConcatTextMessage(txtMessage, unicode, txtDestinationNumbers);
сomm.SendMessages(pdu);

关于c# - 如何在 GSMComm 库中连接长短信?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34918362/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com