0

Hi to ALL
Plz help me
i try my best to send sms from visual studio C# to mobile
but i am not sucessfull so far
if any one knows this yhen plz send me procedure as soon as possible
thanx in advance
Good bye.........

3
Contributors
2
Replies
15
Views
5 Years
Discussion Span
Last Post by gopalju
0

You cannot send text for free, first you need a gateway this is one:
http://www.textlocal.com/

Then you need the api txt local has one for .Net and once you read the documentation you should understand it, hopefully.

0
//download the "activeXpert mobile messaging toolkit" & install it first...

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using AxMmCtlLib;
using Demo.DB_Access_Object;

namespace Demo
{
    class SMS
    {
        public string body = "";
        public string address = "";
        public Gsm objGsm = new GsmClass();
        public SmsConstants objSmsConstants = new SmsConstantsClass();

        public void Send()
        {
            Cursor.Current = Cursors.WaitCursor;
            object obj;
            string strMessageReference;
            SmsMessage objSmsMessage = new SmsMessageClass();

            string strName = "HUAWEI Mobile Connect - 3G Modem";

            int iDeviceSpeed;
            iDeviceSpeed = 0;

            objGsm.Open(strName, "", iDeviceSpeed);
            if (objGsm.LastError != 0)
            {
                if (objGsm.LastError == 36101)
                {
                    MessageBox.Show("This SIM requires a PIN code to be entered.");
                }

                objGsm.Close();
                return;
            }

            objSmsMessage.Clear();
            objSmsMessage.ToAddress = "+8801722631766";
            objSmsMessage.Body = "message body...";

            obj = objSmsMessage;
            objGsm.SendSms(ref obj, 10000);
            objSmsMessage = (SmsMessage)obj;
            strMessageReference = objSmsMessage.Reference;

            if (objGsm.LastError == 0)
            {
                ListViewItem item;
                List<string> lsReferences = new List<string>();
                foreach (string strReference in strMessageReference.Split(','))
                {
                    lsReferences.Add(strReference);
                }
            }

            Cursor.Current = Cursors.Default;
            objGsm.Close();
        }

        public void Receive()
        {
            int nFormat;
            SmsMessage objSmsMessage;
            GsmDeliveryReport objDeliveryReport;
            Cursor.Current = Cursors.WaitCursor;
            string strName = "HUAWEI Mobile Connect - 3G Modem";
            int iDeviceSpeed;
            iDeviceSpeed = 0;

            objGsm.Open(strName, "", iDeviceSpeed);

            if (objGsm.LastError == 36101)
            {
                MessageBox.Show("This SIM requires a PIN code to be entered.");
                return;
            }

            int iType = objSmsConstants.GSM_MESSAGESTATE_ALL;
            bool bDelete = false;
            int iStorageType = objSmsConstants.GSM_STORAGETYPE_ALL;

            if (objGsm.LastError == 0)
            {
                objGsm.Receive(iType, bDelete, iStorageType, 10000);
            }

            if (objGsm.LastError != 0)
            {
                objGsm.Close();
                return;
            }

            objSmsMessage = (SmsMessage)objGsm.GetFirstSms();

            while (objGsm.LastError == 0)
            {
                if (objSmsMessage.BodyFormat == objSmsConstants.BODYFORMAT_TEXT)
                {
                    address = objSmsMessage.FromAddress;
                    body = objSmsMessage.Body;
                    //MessageBox.Show(from + "\n" + body);
                }
                else
                {

                }

                objSmsMessage = (SmsMessage)objGsm.GetNextSms();
            }

            objGsm.Close();
            Cursor.Current = Cursors.Default;
        }
    }
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.