class MyClass
{
public mCore.SMS objSMS = new mCore.SMS();
public static void SendMessage()
{
string strMsg = "This is a very long text message
and";
strMsg = strMsg + " it has more than one hundred
sixty";
strMsg = strMsg + " characters in it. This is to
test how";
strMsg = strMsg + " the long message will be sent
using";
strMsg = strMsg + " mCore .NET SMS Library.";
try
{
SetCommParameters();
objSMS.Encoding = mCore.Encoding.GSM_Default_7Bit;
objSMS.LongMessage = mCore.LongMessage.Concatenate;
try
{
objSMS.SendSMS("+919873094767", "This is a test message");
MessageBox.Show("Message Sent!");
}
catch
(mCore.SMSSendException e)
{
MessageBox.Show("Message Failed!" + "\r\n" + e.ToString());
}
objSMS.Disconnect();
} catch
(mCore.GeneralException e)
{
MessageBox.Show(e.ToString());
}
catch (Exception e)
{
}
}
public static void SetCommParameters()
{
try
{
objSMS.Port = "COM1";
objSMS.BaudRate =
mCore.BaudRate.BaudRate_19200;
objSMS.DataBits =
mCore.DataBits.Eight;
objSMS.StopBits =
mCore.StopBits.One;
objSMS.Parity =
mCore.Parity.None;
objSMS.FlowControl =
mCore.FlowControl.RTS_CTS;
} catch
(mCore.GeneralException e)
{
MessageBox.Show(e.ToString());
}
catch (Exception e)
{
}
}
} |