0

I'm new to this concept of sending sms through java application, can you people help me by saying what are all the ways to send sms from an application

Sasi Dunston
  • 302
  • 1
  • 4
  • 15
  • Is your application web? Does it have to run locally? Please provide more details. – vz0 Jun 04 '14 at 10:03
  • are you using a physical GSM modem or a sms sending gateway ? In the first case it's enough write the correct AT commands on the device, in the second case it depends on your particulare SMS Sending Gateway – BigMike Jun 04 '14 at 10:06
  • I want to use gateway not GSM modem. – Sasi Dunston Jun 04 '14 at 10:27

3 Answers3

1

Yes,you can send sms by java application.but you need to have a sms sending gateway with you.

Abhinab Kanrar
  • 1,532
  • 2
  • 20
  • 46
1

ESBs like Mule, Camel or Spring Integration include connectors for this.

Take a look at:

http://blogs.mulesoft.org/twilio-cloud-connector-2/

http://docs.spring.io/autorepo/docs/spring-integration-smpp/1.0.0.BUILD-SNAPSHOT/reference/htmlsingle/

Andres
  • 10,561
  • 4
  • 45
  • 63
1

Yes, you can send sms through Java but for that you need to sms gateway provider. There are some gateway providers which allow you to send sms free of cost like way2ms, indyarocks etc.

For indyarocks you can refer the following code :

String email = "//your mail id"; //http://www.indyarocks.com/ 
String user = "//indyarocks user id";    
String pass = "//indyarocks password";
String number = ""; //no on which sms is to be send   
String msg = "";//message to be send
try{
       try {
                String mURL;
                mURL = "http://www.onl9class.com/smsapi/smsir.php?email=" + email + "&user=" + user + "&pass=" + pass + "&number=" + number + "&msg=" + URLEncoder.encode(msg, "UTF-8");
                URL url = new URL(mURL);
                BufferedReader reader = null;            
                reader = new BufferedReader(new InputStreamReader(url.openStream(), "UTF-8"));
                String aline;
                aline = reader.readLine();
                while (aline != "") 
                {     
                    JOptionPane.showMessageDialog(null,""+aline);
                    break;
                }
                if (reader != null) 
                {
                    try 
                    {                    
                        reader.close();                    
                    } finally  
                    {
                        System.out.println("Error ");
                    }
                }            
            } catch (Exception ex) 
                {
                    System.out.println("Error "+ex);
                }
        } catch(Exception ex){
            }
Java Enthusiast
  • 654
  • 7
  • 19