title: com.sun.mail.smtp.SMTPAddressFailedException: 554 5.7.1 <cdae-jee-302-01.uci.cu[10.56.14.157]>: Client host rejected: Access denied
body: <p>I'm trying to send a mail with JavaMail.</p>
  
  <pre><code>properties.put("mail.smtp.host", "smtp.estudiantes.ve");
  properties.put("mail.smtp.starttls.enable", "true");
  properties.put("mail.smtp.port",25);
  properties.put("mail.smtp.mail.sender","miemail@estudiantes.ve");
  properties.put("mail.smtp.user", "miemail@estudiantes.ve");
  properties.put("mail.smtp.auth", "true");
  
  session = Session.getDefaultInstance(properties);
  session.setDebug(true);
  
  System.setProperty("java.net.preferIPv4Stack", "true");
  System.setProperty("javax.net.ssl.trustStore", "C:/Program Files/Java/jdk1.7.0_51/jre/lib/security/cacerts");
  
  try{
      MimeMessage message = new MimeMessage(session);
      message.setFrom(new InternetAddress((String)properties.get("mail.smtp.mail.sender")));
      message.addRecipient(Message.RecipientType.TO, new InternetAddress("amigo@estudiantes.ve"));
      message.setSubject("Prueba");
      message.setText("Texto");
  
      Transport t = session.getTransport("smtp");
      t.connect((String)properties.get("mail.smtp.user"), "contrasenna");
      t.sendMessage(message, message.getAllRecipients());
      t.close();
  }catch (MessagingException me){
      //Aqui se deberia o mostrar un mensaje de error o en lugar
      //de no hacer nada con la excepcion, lanzarla para que el modulo
      //superior la capture y avise al usuario con un popup, por ejemplo.
      return;
  }
  </code></pre>
  
  <p>However, it throws the below exception:   </p>
  
  <pre><code> javax.mail.SendFailedException: Invalid Addresses (com.sun.mail.smtp.SMTPAddressFailedException: 554 5.7.1 &lt;cdae-jee-302-01.uci.cu[10.56.14.157]&gt;: Client host rejected: Access denied)
      at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1446)
      at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:736)
      at uci.dalasqq.vista.AlarmasBean.sendEmail(AlarmasBean.java:116)
      at uci.dalasqq.vista.DashboardBean.updatepkicolors(DashboardBean.java:337)
      at uci.dalasqq.vista.DashboardBean.mainConfigPKI(DashboardBean.java:661)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at org.apache.el.parser.AstValue.invoke(AstValue.java:278)
      at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:274)
      at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
      at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
      at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
      at javax.faces.component.UICommand.broadcast(UICommand.java:315)
      at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)
      at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259)
      at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
      at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
      at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:947)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1009)
      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
      at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      at java.lang.Thread.run(Thread.java:744)
  
  Caused by: com.sun.mail.smtp.SMTPAddressFailedException: 554 5.7.1 &lt;cdae-jee-302-01.uci.cu[10.56.14.157]&gt;: Client host rejected: Access denied
      at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1344)
      ... 36 more
  </code></pre>
  
  <p>How is this caused and how can I solve it?</p>