C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Code Snippets » Active Directory »

send sms using c# code


Posted Date: 13 Feb 2008    Resource Type: Code Snippets    Category: Active Directory
Author: Asha MathewsMember Level: Platinum    
Rating: 1 out of 5Points: 20



The following code sample shows how to sent sms using c# code

class MyClass
{
public mCore.SMS objSMS = new mCore.SMS();

public MyClass()

{
objSMS.NewDeliveryReport +=
new mCore.SMS.DeliveryReportHandler(objSMS_NewDeliveryReport);
}

public static void SendMessage()
{
string strResult = "";
string strMsg = "This is a test message"
try
{

SetCommParameters();
objSMS.Encoding = mCore.Encoding.GSM_Default_7Bit;
objSMS.LongMessage = mCore.LongMessage.Concatenate;
objSMS.DeliveryReport = true;
try
{
strResult = objSMS.SendSMS("+919873094767", strMsg);
MessageBox.Show(strResult);
}
catch (mCore.SMSSendException e)
{
MessageBox.Show("Message Failed!" + "\r\n" + e.ToString());
}
}

catch (mCore.GeneralException e)
{
MessageBox.Show(e.ToString());
}
catch (Exception e)
{
}
}

private void objSMS_NewDeliveryReport
(object sender, mCore.DeliveryReportEventArgs e)
{
if (e.Status)
{
MessageBox.Show("MESSAGE DELIVERED" + "\r\n\r\n" +
"TO: " + e.Phone + "\r\n\r\n" +
"DELIVERY DATE/TIME: " + e.DeliveryTimeStamp.ToString() +
"\r\n\r\n" + "[Message Ref.: " +
e.MessageReference.ToString() + "]");
}
else
{
MessageBox.Show("MESSAGE DELIVERY FAILED" + "\r\n\r\n" +
"TO: " + e.Phone + "\r\n\r\n" +
"REPORT DATE/TIME: " + e.DeliveryTimeStamp.ToString() +
"\r\n\r\n" + "[Message Ref.: " +
e.MessageReference.ToString() + "]");
}
}

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)
{
}
}
}



Responses

Author: Nirav M. Mehta    01 May 2008Member Level: Gold   Points : 2
Plz provide whole code with page code also


Author: Sagar Deshpande    07 May 2008Member Level: Bronze   Points : 2
Its a nice snippet


Author: Kamal    07 May 2008Member Level: Gold   Points : 2
hi,

please give full description how this work?

And also it support all network.


Author: Nithya    07 May 2008Member Level: Bronze   Points : 2
pls Descripe about mCore..What is this?
please provide me mCore....


Author: kanagarajum    07 May 2008Member Level: Gold   Points : 2
Hai
Please give full description



Author: venkat kamal    07 May 2008Member Level: Gold   Points : 2
Hi,its nice to see about this article and will u plz provide full description as well as coding...........


Author: vairamuthu    08 May 2008Member Level: Silver   Points : 2
please provide full description


Author: mani    08 May 2008Member Level: Silver   Points : 2
description and comments in detail please


Author: Jaya Kumar    14 May 2008Member Level: Gold   Points : 2
hi,
nice example.
but, are you used sms service this code?

if u used the sms service free or cost?




Author: mani kumar.k.m    14 May 2008Member Level: Gold   Points : 2
hi,
nice example.
its working good. how to use the sms service this code?

if u used the sms service free or cost?

send to me the detail in my mail id - kmmkumar@gmail.com

thanks.


Author: Vasudevan Deepak Kumar    14 May 2008Member Level: Diamond   Points : 2
@Nithya,

A quick search for MCore got me this component: http://www.logixmobile.com/products/mcore/index.asp

Perhaps the author can confirm whether this is the component that she is trying to use for the purpose of sending text messages.


Author: R O B I N    21 May 2008Member Level: Gold   Points : 2
I m facing the problem of sending the message
i m getting the error message
.......ERROR 2016: Unknown error while checking PIN status....
can you suggest any solution for it.


Author: Praveena kandhi    26 May 2008Member Level: Gold   Points : 2
plz explain in detail


Author: vijetha    29 May 2008Member Level: Gold   Points : 2
Nice code


Author: deebpratap    29 May 2008Member Level: Bronze   Points : 2
Hi, concept is great .plz provide abt this in detail..


Author: Chandra Sheker.G    29 May 2008Member Level: Gold   Points : 2
Hi,good code but pls can u sned me full code


Author: Deepak S    18 Aug 2008Member Level: Gold   Points : 0
hai,
Plz send the full code.

Thanks & Regards,

Deepak S


Author: surender    07 Sep 2008Member Level: Silver   Points : 0
Hello Nice T Share ur Knowledge bt can u send me the full code?


Author: Yogini    01 Dec 2008Member Level: Bronze   Points : 1
I want to develop an application in Asp.net 3.5 with c# for sending bulk sms in India. So plz tell me how to do without using modem. if i want to use Sms service provider then tell how to use that in .net & implement. plz provide me all details of implementation fron scratch.

Thanks in advance.


Author: Yogini    01 Dec 2008Member Level: Bronze   Points : 1
I want to develop an application in Asp.net 3.5 & c# for sending bulk sms in India. So plz tell me how to do without using modem. if i want to use Sms service provider then tell how to use that in .net & implement. plz provide me all details of implementation fron scratch.

Thanks in advance.


Author: krishna    05 Dec 2008Member Level: Gold   Points : 0
Hi,good code but pls can u sned me full code

Regards,
Krishna.


Author: KR    12 Dec 2008Member Level: Gold   Points : 0
Hi,
Good code.


Author: Sayre    08 May 2009Member Level: Gold   Points : 0
Hi, Incomplete Code


Author: satya    08 May 2009Member Level: Bronze   Points : 0
GOOD


Author: Selvakumar    01 Jul 2009Member Level: Bronze   Points : 1
Hi all,
pls anybody can give me a sending SMS code(without using modam) ,service provider and gateway details...?

Thanks in Advance


Author: Gaurav Arora    02 Jul 2009Member Level: Diamond   Points : 2
Asha,

Definitely your work is remarkable. But your code does not give any output until you provide following:

1. What are the SMS services your using
2. SMS-Providers for the services
3. Is there any cost involved to use this service or its free

Look simply use a service and just paste the code here is not showing full work.

I have drop you a separate message if you have full service please upload here so others can be benefited from the same.


Author: L Sagar    07 Sep 2009Member Level: Silver   Points : 0
Hi,
super code ...Thanks

Regards
sagar


Author: muthuraman    07 Sep 2009Member Level: Gold   Points : 1
hi mehta,
nice try.
plz give full details, so that it will help us.
thanks,

muthuraman


Author: satya    13 Sep 2009Member Level: Diamond   Points : 1
Hi,
Please provide the full code.

Then it will be useful for all.

Thanks & Regards,
Satya


Author: Pavneet    19 Sep 2009Member Level: Silver   Points : 0
Please Give Full Descrip


Author: Aravind    15 Oct 2009Member Level: Bronze   Points : 1
Thnx
Can u Send me Send full Page code to mail plsss
my mail id is aravindvenkat18@gmail.com



Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
SMS  .  Please give me the Full description....  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: How to disable back button of the browser after logout
Previous Resource: Convert Image to binary format?
Return to Discussion Resource Index
Post New Resource
Category: Active Directory


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use