I recently used the SMS sending function in the development project. I checked the SMS interface. Because it was web development, I chose the com api in the interface!
Of course, you must first reference the empp. dll file in the interface and register
Then implement the following code:
/// <Summary>
/// SMS sending class
/// </Summary>
Public class SMS: DB
{
/// <Summary>
/// Send a text message
/// </Summary>
/// <Param name = "nRecordCount"> mobile phone number. Separate multiple mobile phone numbers with | and end with | </param>
/// <Param name = "nOrder"> text message content </param>
Public static void SendSMS (string mobiles, string contents)
{
// SMS Server IP Address
String host = "211.136.163.68 ";
// SMS Server Port
Int port = 9981;
// Sending account
String accountId = "";
String serviceId = "0 ";
// Send the account password
String password = "";
EMPPLib. emptcl empp = new EMPPLib. emptclClass ();
EMPPLib. ConnectResultEnum result = ConnectResultEnum. CONNECT_OTHER_ERROR;
Result = empp. connect (host, port, accountId, password );
String msg = contents;
EMPPLib. receivmessage shortMsg = new EMPPLib. receivmessageclass ();
ShortMsg. srcID = accountId;
ShortMsg. ServiceID = serviceId;
ShortMsg. needStatus = true;
EMPPLib. Mobiles mobs = new EMPPLib. MobilesClass ();
If (mobiles. indexof ("|")>-1)
{
Char [] Cut = new char [] {'| '};
For (int32 I = 0; I <mobiles. Split (CUT). Length-1; I ++ ){
Mobs. Add (mobiles. Split (CUT) [I]. tostring ());
}
}
Else
{
Mobs. Add (mobiles );
}
Shortmsg. destmobiles = mobs;
Shortmsg. content = MSG;
Shortmsg. sendnow = true;
Empp. needstatus = true;
If (empp! = NULL & empp. Connected = true)
{
Empp. Submit (shortmsg );
}
}