给你发段我的代码,对你应该有所帮助:
var
s1,s2: string;
SendData: string;
begin
s1 := '8613800371500';
s2 := '13137718612';
try
SendData := 'AT';
MSComm1.Output := SendData;
sleep(100);
SendData := 'AT+CMGF=1'+char(13) ;
MSComm1.Output := SendData; //¡®ÉèÖ÷¢Ë͵Äģʽ,×¢Òâ:Ò»¶¨Òª¼ÓÉÏ vbCr
sleep(100);
SendData := 'AT+CSCA=' +QuotedStr('+8613800371500')+char(13);
MSComm1.Output := SendData;
sleep(100);
SendData := 'AT+CMGS="' +s2+'"'+char(13);
MSComm1.Output := SendData;
sleep(100);
SendData := 'hello,alisha11!' +char(26);
MSComm1.Output := SendData; //
sleep(100);
ShowMessage('发送成功!');
except
ShowMessage('发送失败!');
end;