Please find below code for sending SMS
/// <summary>
/// Sends SMS
/// </summary>
/// <returns> Returns true if SMS sent successfully </returns>
private bool SendSMS()
{
try
{
if (string.IsNullOrEmpty( txtSMSPhoneNumber.Text.Trim()) )
{
MessageBox.Show("Please enter Phone Number to send SMS", "SMS Validation",
MessageBoxButtons.OK, MessageBoxIcon.Information);
txtSMSPhoneNumber.Focus();
return false;
}
if (txtSMSPhoneNumber.Text.Trim() .Length < 10)
{
MessageBox.Show("Invalid Phone Number. Please enter valid Phone Number", "SMS Validation",
MessageBoxButtons.OK, MessageBoxIcon.Information);
txtSMSPhoneNumber.Focus();
return false;
}
if (string.IsNullOrEmpty( txtSMSText.Text.Trim()))
{
MessageBox.Show("Please text to SMS", "SMS Validation",
MessageBoxButtons.OK, MessageBoxIcon.Information);
txtSMSText.Focus();
return false;
}
string SMSText = txtSMSText.Text.Trim(). Replace(" ", "");
StringBuilder SMSURL = new StringBuilder();
SMSURL.Append("http:// smsoutbox.info/?user=Abm& password=abm567&PhoneNumber=91 ");
SMSURL.Append( txtSMSPhoneNumber.Text.Trim()) ;
SMSURL.Append("&Text=");
SMSURL.Append(SMSText);
SMSURL.Append("&Sender=Minacs" );
//ProcessStartInfo PSInfo = new ProcessStartInfo("http://www. google.co.in/");
//PSInfo.WindowStyle = ProcessWindowStyle.Minimized;
//PSInfo.CreateNoWindow = true;
//Process.Start(PSInfo);
Process.Start(SMSURL.ToString( ));
ShowWaiting("Sending SMS");
return true;
}
catch (Exception ex)
{
throw new Exception("Error in Function TestCustInfo.SendSMS. Error Message :- "
+ ex.Message, ex);
}
}
No comments:
Post a Comment