Hi,
I have a few simple questions regarding sending SMS from my PC to my moble phone.

I have two libraries which should be able to send SMS messages:

import com.simplewire.sms.*;

public class send_text
{
	public static void main(String[] args) throws Exception
	{
		SMS sms = new SMS();

		// Subscriber Settings
		sms.setSubscriberID("123-456-789-12345");
		sms.setSubscriberPassword("Password Goes Here");

		// Optional Message Settings
		// Specify source and destination ports that will appear
		// in the GSM User-Data-Header
		//sms.setSourcePort((short)0x0000);
		//sms.setDestPort((short)0x0000);
		//
		// Specify a network type "hint" - helps Simplewire
		// choose between a TDMA vs. GSM network for example.
		// Only useful for certain types of messages such as
		// WAP push or MIDP Java WMA messages and if the destination
		// operator runs both TDMA and GSM networks.
		// sms.setNetworkType(SMS.NETWORK_TYPE_GSM);

		// Message Settings
		sms.setMsgPin("+11005101234");
		sms.setMsgFrom("Demo");
		sms.setMsgCallback("+11005551212");
		sms.setMsgText("Hello World From Simplewire!");

		System.out.println("Sending message to Simplewire...");

		// Send Message
		sms.msgSend();

		// Check For Errors
		if(sms.isSuccess())
		{
			System.out.println("Message was sent!");
		}
		else
		{
			System.out.println("Message was not sent!");
			System.out.println("Error Code: " + sms.getErrorCode());
			System.out.println("Error Description: " + sms.getErrorDesc());
			System.out.println("Error Resolution: " + sms.getErrorResolution() + "\n");
		}
	}
}

What would represend the subscriber ID and the password? I need a modem or something? Or can I find that ID and password from my provider?
MsgPin("+11005101234"); is the destination number?
MsgCallback("+11005551212"); is my number?

The second example

IntelliSMS objIntelliSMS = new IntelliSMS();
        objIntelliSMS.Username = "MyUsername";
        objIntelliSMS.Password = "MyPassword";
        String[] toList = new String[]{"44771012345,44771023456"};
        try {
            objIntelliSMS.SendMessage(toList, "Hello", "SENDER_ID");
        } catch (IntelliSMSException ex) {
            Logger.getLogger(main.class.getName()).log(Level.SEVERE, null, ex);
        }

What does Username, password and SENDER_ID String represents?

Thanks... and sorry I don't know what probably would be very simple (I searched about it)

Recommended Answers

All 7 Replies

You need a mobile phone attached to your computer, probably, and probably a specific type, or an internet gateway, to which you would probably need a subscription. Check with whoever/wherever you got that "SMS" and "IntelliSMS" class.

I figured it out how to send SMS through my mobile phone attached to computer but I wanted to use the network instead of device to send that SMS. I contacted a phone communication company by email and they said that the SMS Service through Internet is not available in their network... However I will use the phone/modem solution because I can't figure out the other issue... and it costs probably more money since I would get a contract or something.

I guess I should mark this as solved... ?

I figured it out how to send SMS through my mobile phone attached to computer but I wanted to use the network instead of device to send that SMS.

Trying to avoid the SMS charge?

Well... I just wanted my application to be independent of any devices. Just connected to internet and send SMS via their network from internet. It would be just nice and portable. I said I will use the other solution if I don't have any chance with this. That means I get a phone and a SIM or a modem and use that.

import com.simplewire.sms.*;

public class send_text
{
	public static void main(String[] args) throws Exception
	{
		SMS sms = new SMS();

		// Subscriber Settings
		sms.setSubscriberID("2055347428");
		sms.setSubscriberPassword("4119");

		// Optional Message Settings
		// Specify source and destination ports that will appear
		// in the GSM User-Data-Header
		//sms.setSourcePort((short)0x0000);
		//sms.setDestPort((short)0x0000);
		//
		// Specify a network type "hint" - helps Simplewire
		// choose between a TDMA vs. GSM network for example.
		// Only useful for certain types of messages such as
		// WAP push or MIDP Java WMA messages and if the destination
		// operator runs both TDMA and GSM networks.
		// sms.setNetworkType(SMS.NETWORK_TYPE_GSM);

		// Message Settings
		sms.setMsgPin("+11005101234");
		sms.setMsgFrom("Demo");
		sms.setMsgCallback("+11005551212");
		sms.setMsgText("Hello World From Simplewire!");

		System.out.println("Sending message to Simplewire...");

		// Send Message
		sms.msgSend();

		// Check For Errors
		if(sms.isSuccess())
		{
			System.out.println("Message was sent!");
		}
		else
		{
			System.out.println("Message was not sent!");
			System.out.println("Error Code: " + sms.getErrorCode());
			System.out.println("Error Description: " + sms.getErrorDesc());
			System.out.println("Error Resolution: " + sms.getErrorResolution() + "\n");
		}
	}
}

Thanks but I could not obtain an account frmo my provider. So I just use my phone to send messages.

There are many service providers who'd be more than happy to sell you services to send SMS through their networks.
But you're not going to get a freeby.

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.