This program attempts to send email by first connecting to `smtp.rediffmail.com` . There is no compile time error or compile time exception.But as i try to run the following program it generates the following exception.

**javax.mail.SendFailedException: Invalid Addresses;
 nested exception is:
 com.sun.mail.smtp.SMTPAddressFailedException: 421 Authorization failed: please authenticate by
 doing get message first**

I can't figure out what the exception is and why i am getting this exception .

Here is the complete program.In this i have tried to make *TLS* connection with rediffmail server.

```
import javax.mail.Authenticator;
import javax.mail.PasswordAuthentication;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import java.util.Properties;

class rediff {
   public static void main(String args[]) {
      Properties props = new Properties();
      props.put("mail.smtp.host", "smtp.rediffmail.com");
      props.put("mail.stmp.user", "from");

      //To use TLS
      props.put("mail.smtp.auth", "true");
      props.put("mail.smtp.starttls.enable", "true");
      props.put("mail.smtp.password", "password");

      Session session = Session.getDefaultInstance(props, new Authenticator() {
        @Override
            protected PasswordAuthentication getPasswordAuthentication() {
               String username = "from";
               String password = "password";
                return new PasswordAuthentication("from", "password");
            }
      });
       String to = "me@gmail.com";
       String from = "from@rediff.com";
       String subject = "Testing...";
       MimeMessage msg = new MimeMessage(session);
         try {
           msg.setFrom(new InternetAddress(from));
           msg.setRecipient(MimeMessage.RecipientType.TO, new InternetAddress(to));
           msg.setSubject(subject);
           msg.setText("rediff program working...!");
           Transport transport = session.getTransport("smtp");
           transport.send(msg);
           System.out.println("fine!!");
         }   catch(Exception exc) {
                 System.out.println(exc);
              }
   }
}

```

Why do i get this exception ?