Logo 
Search:

Unix / Linux / Ubuntu Answers

Ask Question   UnAnswered
Home » Forum » Unix / Linux / Ubuntu       RSS Feeds
  Question Asked By: Ravi Kancharla   on May 23 In Unix / Linux / Ubuntu Category.

  
Question Answered By: Abhishek Singh   on May 23

Yes,we can send SMs Using our Java Program.These are the steps Note:Ipipi allows you to send only 5 sms free of cost,After that create one more account 1> create an account in http://www.ipipi.com/ 2>I created Account like this: username: surajSMS password: suraj1233>Prepare the program in this way SendSMS.java
?12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 import java.io.*; import java.net.InetAddress; import java.util.Properties; import java.util.Date; import javax.mail.*; import javax.mail.internet.*; import javax.activation.*; public class SendSMS { public SendSMS() {} //create an account on ipipi.com with the given username and password public void msgsend() { String username = "surajSMS"; //Your Credentials String password = "suraj123"; String smtphost = "ipipi.com"; //Ip/Name of Server String compression = "None"; //I dont want any compression String from = "surajSMS@ipipi.com"; //ur userid@ipipi.com //This mobile number need not be registered with ipipi.com String to = "919861098610@sms.ipipi.com"; //mobile number where u want to send sms String body = "Hi This Msg is sent through Java Code"; Transport tr = null; try { Properties props = System.getProperties(); props.put("mail.smtp.auth", "true"); // Get a Session object Session mailSession = Session.getDefaultInstance(props, null); // construct the message Message msg = new MimeMessage(mailSession); //Set message attributes msg.setFrom(new InternetAddress(from)); InternetAddress[] address = {new InternetAddress(to)}; msg.setRecipients(Message.RecipientType.TO, address); msg.setSubject(compression); msg.setText(body); msg.setSentDate(new Date()); tr = mailSession.getTransport("smtp"); //try to connect tr.connect(smtphost, username, password); msg.saveChanges(); //send msg to all recipients tr.sendMessage(msg, msg.getAllRecipients()); tr.close(); } catch (Exception e) { e.printStackTrace(); } } public static void main(String[] argv) { SendSMS sms = new SendSMS(); sms.msgsend(); System.out.println("Successfull"); } }

Share: 

 

This Question has 1 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on send sms programme Or get search suggestion and latest updates.


Tagged: