title: Unable to send a email from java program : Unable to relay for abc@wipro.com
body: <p>I am trying to send an email using a java program using this post <a href="http://www.javatpoint.com/example-of-sending-email-using-java-mail-api" rel="nofollow">Java Point Post</a>. </p>
  
  <pre><code>import java.util.Properties;  
  import javax.mail.*;  
  import javax.mail.internet.*;  
  
  public class SendMailBySite {  
   public static void main(String[] args) {  
  
    String host="IPADDRESS";  
    final String user="abc@wipro.com";//change accordingly  
    final String password="xxx";//change accordingly  
  
    String to="abc@wipro.com";//change accordingly  
  
     //Get the session object  
     Properties props = new Properties();  
     props.put("mail.smtp.host",host);  
     props.put("mail.smtp.auth", "true");  
  
     Session session = Session.getDefaultInstance(props,  
      new javax.mail.Authenticator() {  
        protected PasswordAuthentication getPasswordAuthentication() {  
      return new PasswordAuthentication(user,password);  
        }  
      });  
  
     //Compose the message  
      try {  
       MimeMessage message = new MimeMessage(session);  
       message.setFrom(new InternetAddress(user));  
       message.addRecipient(Message.RecipientType.TO,new InternetAddress
  
  (to));  
       message.setSubject("javatpoint");  
       message.setText("This is simple program of sending email using 
  
  JavaMail API");  
  
      //send the message  
       Transport.send(message);  
  
       System.out.println("message sent successfully...");  
  
       } catch (MessagingException e) {e.printStackTrace();}  
   }  
  }  
  </code></pre>
  
  <p>I have entered IpAddress correctly and my mail id an password correctly. But when am trying to run this program am getting some exception.</p>
  
  <pre><code>java SendEmail
  javax.mail.SendFailedException: Sending failed;
    nested exception is:
          class javax.mail.SendFailedException: Invalid Addresses;
    nested exception is:
          class javax.mail.SendFailedException: 550 5.7.1 Unable to relay for abc@wipro.com
  
          at javax.mail.Transport.send0(Transport.java:218)
          at javax.mail.Transport.send(Transport.java:80)
          at SendEmail.main(SendEmail.java:27)
  </code></pre>
  
  <p>Please help. Thanks in advance.</p>