Results 1 to 5 of 5
  1. #1
    10e5x is offline Member
    Join Date
    Nov 2010
    Posts
    33
    Rep Power
    0

    Default How to send sms using java

    i have done the following codes:

    public class Sms {

    public Sms() {
    }

    public void msgsend() {

    String username = "guoxiang";
    String password = "*******";
    String smtphost = "ipipi.com";
    String compression = "on";
    String from = "guoxiang@gmail.com";
    String to = "92706121";
    String body = "Hello SMS World!";
    Transport myTransport = null;

    try {
    Properties props = System.getProperties();
    props.put("mail.smtp.auth", "true");
    Session mailSession = Session.getDefaultInstance(props, null);
    Message msg = new MimeMessage(mailSession);
    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());

    myTransport = mailSession.getTransport("smtp");
    myTransport.connect(smtphost, username, password);
    msg.saveChanges();
    myTransport.sendMessage(msg, msg.getAllRecipients());
    myTransport.close();
    } catch (Exception e) {
    e.printStackTrace();
    }
    }
    public static void main(String[] argv) {
    Sms smtpSend = new Sms();
    smtpSend.msgsend();
    }


    }

    i got the error

    javax.mail.AuthenticationFailedException: 535 Authentication Failed

    at com.sun.mail.smtp.SMTPTransport$Authenticator.auth enticate(SMTPTransport.java:648)

    please help me

  2. #2
    goldest's Avatar
    goldest is offline Senior Member
    Join Date
    Oct 2009
    Location
    Pune, India
    Posts
    469
    Rep Power
    5

    Angry

    Quote Originally Posted by 10e5x View Post
    please help me
    Really? Why? So that you can run away in between and waste our efforts?

    If I remember correctly, you were the same user who asked for help while sending mail using Java. Here is the link for that thread: Using Java Send Email


    Did you implement what I told you there?
    Quote Originally Posted by goldest View Post
    You would have to override the Authenticator's getPasswordAuthentication() method in order to validate the authentication.

    I don't think so. You simply neglected that and moved away, which made me feel like an Idiot, who wasted my time trying to help you out.

    Now, you have come across the same issue and you are seeking for help again. Why I or even anyone else here should help you out? What's the point if you are not going to listen to us?

    If you are going to skip or run away from your problems now, somewhere down the line you will face them again. What will you do then?

    Now, the solution to your current problem is the same thing which was advised to you in your previous thread. What will you do now?

    Goldest
    Java Is A Funny Language... Really!
    Click on * and add to member reputation, if you find their advices/solutions effective.

  3. #3
    10e5x is offline Member
    Join Date
    Nov 2010
    Posts
    33
    Rep Power
    0

    Default

    i didnt run away from the prev problem, i solved it thanks to you. i remembered.nvm then i try it myself. thanks for the advice.

  4. #4
    quad64bit's Avatar
    quad64bit is offline Moderator
    Join Date
    Jul 2009
    Location
    VA
    Posts
    1,323
    Rep Power
    7

    Default

    i didnt run away from the prev problem, i solved it thanks to you.
    If thats the case, you need to thank the contributors and close the thread.

  5. #5
    10e5x is offline Member
    Join Date
    Nov 2010
    Posts
    33
    Rep Power
    0

Similar Threads

  1. Replies: 10
    Last Post: 06-06-2010, 06:49 PM
  2. How to send a java file?
    By Drareeg in forum New To Java
    Replies: 7
    Last Post: 05-10-2010, 09:29 PM
  3. how to send SMS using Java API
    By sanjeevtarar in forum Advanced Java
    Replies: 4
    Last Post: 09-13-2009, 03:15 PM
  4. How to send SMS using JAVA
    By sivaskgr in forum New To Java
    Replies: 0
    Last Post: 03-18-2009, 01:37 PM
  5. Send a pic through mail, in java
    By lenny in forum Advanced Java
    Replies: 1
    Last Post: 07-25-2007, 02:49 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •