I'm currently developing an SMS sender using C# (2010). The program does send the message but the message received was not the message sent, (i.e " yt+ 35") and while running the program several times, the received message do not contain anything at all, even the senders number.

I am using a GSM modem and COM port for sending.

Any idea what I am missing here?

Code found in the Class:

if (this.serialPort.IsOpen == true)
        {
            try
            {
                this.serialPort.WriteLine("AT" + (char)(13));
                Thread.Sleep(4);
                this.serialPort.WriteLine("AT+CMGF=1" + (char)(13));
                Thread.Sleep(5);
                this.serialPort.WriteLine("AT+CMGS=\"" + cellNo + "\"");
                Thread.Sleep(10);
                this.serialPort.WriteLine(">" + messages + (char)(26));
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Source);
            }
            return true;
        }
        else
        return false;

Recommended Answers

All 3 Replies

Code looks too light to me. It seems to be that old first try type effort. Anyhow, be sure to try this with a terminal program first.

That said, we implemented this long ago and no, I can't share the code as it belongs to the company but I will write that we used terminal apps to manually drive the modem around at first.

One of the team had a problem like yours. Turns out their account with the cellular company wasn't active or was limited to so many texts a day.

The modem's sim card is loaded. Here in Philippines, as long as a subscriber is registered to a text or call promo. doesn't really matter how many texts or call you make as long as that subscription hasn't expired yet.

It really is just that the messages I sent are recieved but as I said, doesn't show anything.

You didn't reply that you made it work with a terminal so how do you know your commands and strings are right? Also your code is sending blindly. That is, you are not looking at the responses to the commands.

So a "promo" and not a fully activated account. I don't see where you configured your modem's APN but as a developer let's hope you know this from top to bottom.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.