How to send SMS from Java program?

Hello,
I want to know, how can I send SMS from Java program.I dont have any idea about SMS gateways. Can any one give me Sample code for sending the SMSs from Java Program.
Thanks,
-BR

hi,
refer javamail concepts
http://www.google.co.in/search?q=javamail+simple+example&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a

Similar Messages

  • How to send sms through java program?

    hi,
    i am trying to send sms through java program.i am usining ubuntu 6.04.i am using modem MC35i.i use the jSMSEnjine.jar and rxtxcomm.jar.
    these are the following program.
    import org.jsmsengine.*;
    import java.util.*;
    class SendMessage
         public static void main(String[] args)
              int status;
              // Create jSMSEngine service.
         CService srv = new CService("Com2",9600);
              //CService srv = new CService("COM2",9600);
              System.out.println();
              System.out.println("SendMessage(): sample application.");
              System.out.println(" Using " + srv._name + " " + srv._version);
              System.out.println();
              try
                   //     Initialize service.     
                   srv.initialize();
                   Thread thread =Thread.currentThread();
                   thread.sleep(1000);
                   System.out.println(srv);
                   //     Set the cache directory.
                   srv.setCacheDir(".\\");
                   //     Set the phonebook.
                   //     srv.setPhoneBook("../misc/phonebook.xml");
                   //     Connect to GSM device.
                   status = srv.connect();
                   //     Did we connect ok?
                   int st=CService.ERR_OK;
                   System.out.println(st);
                   System.out.println(status);
                   if (status == CService.ERR_OK)
                        //     Set the operation mode to PDU - default is ASCII.
                        srv.setOperationMode(CService.MODE_PDU);
                        // Set the SMSC number (set to default).
                        srv.setSmscNumber("");
                        //     Print out GSM device info...
                        System.out.println("Mobile Device Information: ");
                        System.out.println("     Manufacturer : " + srv.getDeviceInfo().getManufacturer());
                        System.out.println("     Model : " + srv.getDeviceInfo().getModel());
                        System.out.println("     Serial No : " + srv.getDeviceInfo().getSerialNo());
                        System.out.println("     IMSI : " + srv.getDeviceInfo().getImsi());
                        System.out.println("     S/W Version : " + srv.getDeviceInfo().getSwVersion());
                        System.out.println("     Battery Level : " + srv.getDeviceInfo().getBatteryLevel() + "%");
                        System.out.println("     Signal Level : " + srv.getDeviceInfo().getSignalLevel() + "%");
                        //     Create a COutgoingMessage object and dispatch it.
                        //     *** Please update the phone number with one of your choice ***
    // String smsLengthTest="Hi"+"\nTesting is going on.Test for sending unlimited number of charecter.So you will get N number of SMS.Initially I trancate the whole string by 70 charecter.Later I will put it upto 90 charecter.Some chararecter should kept for header portion.I don't know the total number.It is just test.If you got the sms u should appreciate me...This is Ripon...I have written sms program";
    String smsLengthTest="Hi\n"+"This is Govindo";
    int mao=smsLengthTest.length();
    System.out.println("Length of sms :"+mao);
    String smsNo="9433314095";
    smsNo="+91"+smsNo;
    if(mao<70)
    COutgoingMessage msg = new COutgoingMessage(smsNo,smsLengthTest);
    //     Character set is 7bit by default - lets make it UNICODE :)
    //     We can do this, because we are in PDU mode (look at line 63). When in ASCII mode,
    //          this does not make ANY difference...
    msg.setMessageEncoding(CMessage.MESSAGE_ENCODING_UNICODE);
    if (srv.sendMessage(msg) == CService.ERR_OK) System.out.println("Message Sent!");
    else System.out.println("Message Failed!");
    else
    // COutgoingMessage msg = new COutgoingMessage(smsNo,smsLengthTest);
    // LinkedList messageList;
    // messageList = new LinkedList();
    // messageList.add(msg);
    // LinkedList maooo=new LinkedList();
    // maooo=srv.splitLargeMessages(messageList);
    int sizelength=0;
    int counter=0;
    sizelength=smsLengthTest.length();
    System.out.println("SMS length :"+sizelength);
    int smsCntr=sizelength/70;
    System.out.println("smsCntr :"+smsCntr);
    counter=smsCntr+1;
    int j=70;
    int k=0;
    try
    for(int i=0;i<smsCntr;i++)
    String test="";
    test=test+i;
    test=smsLengthTest.substring(k,j);
    System.out.println(test);
    System.out.println(test.length());
    COutgoingMessage msg = new COutgoingMessage(smsNo, test);
    System.out.println("hi this is suman" + smsNo);
    //     Character set is 7bit by default - lets make it UNICODE :)
    //     We can do this, because we are in PDU mode (look at line 63). When in ASCII mode,
    //          this does not make ANY difference...
    msg.setMessageEncoding(CMessage.MESSAGE_ENCODING_UNICODE);
    if (srv.sendMessage(msg) == CService.ERR_OK) System.out.println("Message Sent!");
    else System.out.println("Message Failed!");
    k=k+70;
    j=j+70;
    catch(Exception e)
    System.out.println("Error...1");
    e.printStackTrace();
    e.getMessage();
    String lastPortion=smsLengthTest.substring(k);
    System.out.println(lastPortion);
    COutgoingMessage msg = new COutgoingMessage(smsNo, lastPortion);
    //     Character set is 7bit by default - lets make it UNICODE :)
    //     We can do this, because we are in PDU mode (look at line 63). When in ASCII mode,
    //          this does not make ANY difference...
    msg.setMessageEncoding(CMessage.MESSAGE_ENCODING_UNICODE);
    if (srv.sendMessage(msg) == CService.ERR_OK) System.out.println("Message Sent!");
    else System.out.println("Message Failed!");
                        // Disconnect from GSM device.
                        srv.disconnect();
                   else System.out.println("Connection to mobile failed, error: " + status);
              catch (Exception e)
                   e.printStackTrace();
              System.exit(0);
    the error is:
    SendMessage(): sample application.
    Using jSMSEngine API 1.2.6 (B1)
    org.jsmsengine.CService@addbf1
    0
    -101
    Connection to mobile failed, error: -101
    please help me,its very urgent.

    come back in about 5 years, we may have time for you by then.
    In the meantime, how about contacting the people who wrote that library and asking them nicely for help (rather than trying to order people to drop whatever they're doing and jump through hoops to accommodate your every wish as you're doing here)?

  • How to send sms from java code

    hi
    I have involved in a project where I need to send sms to mobile from java code.Can anyone help me.if u have code please send me.
    thanks
    dhinesh

    Hi,
    there are several methods to do so but using Web Services is an easier one. Google will help you to find a provider. (E.x. http://www.remotemethods.com/home/communic/sms .)
    Best wishes,
    Christian Ullenboom | http://www.tutego.com/

  • How to send SMS from JSP application.

    Hi,
    I have created a web application using JSP for our Office internal use. I want to include the folowing option in our app.
    1) How to send SMS from the application to mobile.
    2) I don't want to use third party service (ex: SimpleWire). as the app is for internal purpose only.
    It will be helpful, if I get the complete procedure to implement it, as this is my first application.
    Thanks & Regards
    suresh.

    I am having problem with smslib. smslib is an enhanced version of jsmengine, I have compiled the program, there is no error but when I run it , the following error is found. Can you help? my email is [email protected]
    Exception in thread "main" java.lang.NoClassDefFoundError: CIncomingMessage (wrong name: org/smslib/CIn
    comingMessage)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)

  • How to send SMS from a servlet  to a mobile phone

    How to send SMS from a servlet to a mobile phone what are the things i have to do.......
    very urgent..

    Hi, please read this:
    http://forum.java.sun.com/thread.jspa?threadID=345296&messageID=2608297
    Found on the very forum with the search function ;)

  • How to Send SMS from Oracle Database to Mobile

    Hi All,
    I need urgent help in how to send sms from oracle database to mobile
    thanks and best regards

    you can use smslib..... . i have made a program with this. its working fine with oracle database.
    see the links here ...
    http://halimdba.blogspot.com/2011/08/send-sms-from-oracle-database-with.html
    by the way, how you can say "urgent help" ?
    regards
    Halim

  • How to send sms from jsp

    how to send sms from jsp

    First of all, you need to have the gsm modem or access to any Telco sms gateway.
    If you don have any access to the Telco sms gateway, try to download the SMSLib-Java-v2.1.2 java library from the http://sourceforge.net/project/showfiles.php?group_id=164313.
    Edit the example in the download file and include the example in your JSP file to send the sms using GSM modem.

  • How to send sms from iPad via iphone

    How to send sms from iPad via iphone?

    You don't easily.
    The pad, with I message turned on, will send text like messages to any other ios5 user that has I message turned on.
    The pad is not a phone, and does not have the radio to send 'real' SMS messages, which use the phone channel.
    There are a few apps in the store that will convert messages to SMS, for use with non apple folks.  Check out the app store.  Search SMS.

  • How to send sms from oracle application to cell phone

    Hi all
    please send me in how to send sms from oracle application to cell phone. Is there any way to solve this task. if so please suggest me.

    Please see old threads for similar discussion -- http://forums.oracle.com/forums/search.jspa?threadID=&q=SMS&objID=c3&dateRange=all&userID=&numResults=15&rankBy=10001
    Thanks,
    Hussein

  • How to send SMS from SAP to Any mobile

    Hi Friends,
    I have a requrement. How to send SMS from SAP to Any mobile?? For Example: If i created PO in SAP then i want to send a SMS to Concerned Vendor and HOD.
    Please provide the pre-requisites?
    Naveen

    Hi Naveen,
    there is a standard webservice globally available called Send SMS and you can consume that webservice with the help of CAF and you can send PO number as SMS, If the standard webservice do not work then you have to create your own webservice to fulfill the functionality.
    Regards
    Manohar

  • How to send SMS from Computer to Iphone 5

    How to send SMS from Computer to Iphone 5 ??

    You must have a computer running Mountain Lion in order to use iMessage on a Mac.

  • Help Me! How to send sms from a java program with a pda connected to system

    help me ,
    I am new in JavaME. I have to send sms from a java program, A PDA is connect to the system. Can some one help me to make that program which interact with PDA connected to system and send sms to any mobile or pda phones.

    user12873853 wrote:
    I believe JavaMail API will help in sending the mails and SMS through SMTP server. Sounds more like false hope than belief to me. The only way that would work is if you have an SMS gateway that allows communication through SMTP. Doubtlessly some exist (searching for 'JavaMail sms' through google certainly seems to indicate this), but if you have to ask you don't have one.
    And that exactly where you are stuck: to send SMS messages you need an SMS gateway. That will be the first thing you have to shop for, until then there is no reason to think about code, protocols or implementations. It can be as simple as hooking up a mobile phone, but then you cannot send bulk messages of course. Most likely you'll need to shop around for a partner that has an SMS blasting service you can use.

  • How to send sms from pc to various mobile service in india

    I am trying to send sms from my pc to various service provider(airtel, hutch, bsnl).But i am able to send only to airtel connection(using thier website : [email protected]). But i am unable to send to other service provider. Or is it required to have SMS centre(SMSC) for sending SMS And also how inditimes 8888 will work(automatic replay for SMS)
    Anybody can help in this topic
    Thanking you

    do google search. there are a lot of free sms gateways available over the internet. they come with java apis too. generally speaking, an sms can be sent to a phone only thru its SMSC. however, some sms gateways need you to connect a mobile to your com port so that they can send sms thru that. (in that case the sms flow will be like this: yourcomputer --> your mobile --> your mobile's smsc --> receiving phone's smsc --> receiver phone) hope i have not confused you..
    regards
    raamam

  • How to send sms from gsm modem(AT commands) to j2me application(not inbox)

    hi
    i want to send sms from gsm modem to a j2me application, for this to happen i have to send sms to a specific port in which j2me application is running.when i m trying to send sms from modem it doesnt go to application it goes to inbox.
    is it related to udh settings if yes then how do i set port no in settings?if no what are the other ways.

    Hi Vignesh,
    Might be you can call ActiveX or DLL objects of the software installed for modem from LabVIEW, if it is unblocked.
    Have a  look on the link > http://zone.ni.com/devzone/cda/tut/p/id/2983
    CLA 2014
    CCVID 2014

  • Howe to send sms from oracle forms

    i need your help plzz i wana to send sms from my applicatin

    in normal case you will need an provider for sending sms (pswin,clickatell...) and the easiest way send sms is with a http-api, provided by most of these providers.
    You can do the http-request in forms, by using web.show_document or webutil or, that is the method i prefer put it in the database and let a stored procedure handle the sms-sending. Here is a example of using such an api:
    url := 'http://xxx.xxx.com/send/?typ=2&from=mecker&to='
    || UTL_URL.escape(vMobileNo, true, 'ISO-8859-1')
    || '&txt=' || UTL_URL.escape(vMessageText, true, 'ISO-8859-1')
    ||'&id=myaccount&pwd=testpw&autoroute=1';
    UTL_HTTP.SET_TRANSFER_TIMEOUT(120);
    resp_pieces := utl_http.request_pieces(url);
    for i in 1..resp_pieces.count loop
    value := value || resp_pieces(i);
    end loop;
    There is another example on the pswin homepage at:
    http://www.pswin.com/_pswincom/Downloads/SMS_UTIL.PKS.txt
    I am also sending SMS with unicode, a little bit more complex, if you need unicode-characters let me know ([email protected]), i will give you an example.

Maybe you are looking for

  • Adding new field in customized table ZPM_QMEL_EXT

    Hi all, My requirement is  to add a new field in ZPM_QMEL_EXT table numeric field no of  months due (ZZ_CO_MON_DUE) . Its value will be calculated as the # of invoices that were paid vs. what has not been paid and then from there, value of this field

  • Blank row in table....

    Hi all,        I have a serious problem with the table UI. In screen 1 ,I have  a table where I multiselect the table rows and press "next Button" this action leads to the Screen 2, where a summary of the previously selected rows is displayed.. Here

  • In CRM Date stored in std table is in YYYYMMDDhhmmss format.

    Hello,     Can any one guide me on how to convert this YYYYMMDDhhmmss date format to normal system date format sy-datum. All orders in CRM are storing order changed date & created date in this format. Same field type cannot be used in any selection s

  • Authorizations Bw migration

    Hi experts, we are testing the upgrade of bw from 3.5 to 7.0 version and we are facing huge trubles and doubts concerning to authorizations. 1-Could we keep the old authorization concept how and when is this decision possible? 2- We are testing the n

  • RMI connection refused

    Hello to all, I have created and completed an RMI chat application and tested it on my localhost. It worked all right. Now I want to make it live i.e. run it through internet. Is it same as running on localhost only we have to change the IP address f