C# 短信发送错误(AT 命令)

C# SMS Sending Error ( AT Commands)

大家好,我正在尝试使用 AT 命令从 window 表单发送短信。但是卡在了这个功能上。它说“Failed to set message format.

recievedData = ExecCommand(port,"AT+CMGF=1", 1000, "Failed to set message format."); // Error in this line => Failed to set message format

String command = "AT+CMGS=\"" + PhoneNo + "\"";
                recievedData = ExecCommand(port,command, 300, "Failed to accept phoneNo");         
                command = Message + char.ConvertFromUtf32(26) + "\r";
                recievedData = ExecCommand(port,command, 3000, "Failed to send message"); //3 seconds
                if (recievedData.EndsWith("\r\nOK\r\n"))
                {
                    isSend = true;
                }
                else if (recievedData.Contains("ERROR"))
                {
                    isSend = false;
                }
                return isSend;
            }
            catch (Exception ex)
            {
                throw ex; 
            }

        }     

首先尝试使用超级终端发送消息.. 那么这是我的代码

_serialPort.Open();
_serialPort.Write("AT+CMGF=1\r");
_serialPort.Write("AT+CMGS=\"" + mobilenumber + "\"\r\n");
_serialPort.Write("My Mesage" + "\x1A");
_serialPort.Close();