发送手机短信代码

{发送手机短信}
function SendMobileMessage(telNum, msgContent: AnsiString):Boolean;
var
idHTTP: TIdHTTP;
postStream: TStringStream;
content,str: AnsiString;
begin
idHTTP := TIdHTTP.Create(nil);
postStream := TStringStream.Create('', TEncoding.UTF8);
try
try
{账号zkzb=zhongkuang123}
{协议包头定义}
idHTTP.Request.ContentType := 'application/x-www-form-urlencoded'; {定义发送mime类型}
idHTTP.HandleRedirects := True; {允许重定向,因为这个站点会发生重定向 }
idHTTP.Request.Connection := 'Keep-Alive';
idHTTP.Request.UserAgent := 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022)';
content := 'http://api.smsbao.com/sms';
str := '?u=' + ('amwgaii' ) +
'&p=' + ( md5jm.MD5Print( MD5String( 'amwgaii' ) ) )+
'&m=' + ( telNum )+
'&c=' + TNetEncoding.URL.Encode(string( msgContent ) );
str := content + str;
IdHTTP.get(str, postStream);
Result :=True;
except
Result :=False;
end;
finally
idHTTP.Free;
postStream.Free;
end;
end;

    推荐阅读