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
Asked
Active
Viewed 424 times
0
-
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 Answers
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:

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
-
ya i've got the account in way2sms and i surfed for sample programs also in google.I've tried with that but i couldn't get any propers output – Sasi Dunston Jun 04 '14 at 10:43
-
@SasiDunston you can refer the code i have posted for indyarocks. – Java Enthusiast Jun 04 '14 at 10:56
-
i'm not able to find the code you have posted on the links Indyarocks @gau123 – Sasi Dunston Jun 04 '14 at 11:15
-
-
ya i've got the code and its working correctly but its not delivering the message @gau123 – Sasi Dunston Jun 04 '14 at 11:38
-
try sending sms on any other number because its working for me – Java Enthusiast Jun 04 '14 at 11:39
-
should i've to add 91- or +91 before the number or what its not working for me @gau123 – Sasi Dunston Jun 04 '14 at 11:55
-
you don't need to add 91 or +91..is it printing anything on the console output window ? @SasiDunston – Java Enthusiast Jun 04 '14 at 11:58
-
-
if it is just printing the word "Error" then message must have been sent..it indicates successful message delivery..check the number on which you are sending sms for "DND User"..if it is, then message will not be delivered..these gateways don't send messages to DND Users – Java Enthusiast Jun 04 '14 at 12:02
-
thing hat it worked for one time and not on another time along with that i need know how it works can you send me a detailed instructions of how it works dunston08@gmail.com – Sasi Dunston Jun 04 '14 at 12:08
-
@gau123 this is what i get when the above code executed `Error java.io.IOException: Server returned HTTP response code: 403 for URL` and message is not received – Santhosh Jun 05 '14 at 11:03
-
@sankrish have u registered on indyarocks.com because in the above code you have to enter your indyarocks id, password and email that you have registered over there – Java Enthusiast Jun 05 '14 at 12:01
-