3 Replies Latest reply on Jul 4, 2012 6:39 AM by br3t3s

    Seam  2 and javax.mail.NoSuchProviderException: smtp

    br3t3s Newbie



      I have a problem with sending mail using Java Mail API. I've added dependencies on my EAR project pom.xml.




      When I'm running my app on JBoss 6.1 and execute action always see on console log javax.mail.NoSuchProviderException: smtp.


      I don't want to use Seam Mail. I'm trying to write my own simple mail client.


      Can anyone tell me how to configure Seam application to avoid javax.mail.NoSuchProviderException: smtp ?


      My test bean sending a mail


      public class MessageBean {
      public void send() {
                          Properties props = System.getProperties();
                          props.put("mail.smtp.host", "smtp.gmail.com");
                          props.put("mail.smtp.socketFactory.port", "465");
                          props.put("mail.smtp.auth", "true");
                          props.put("mail.smtp.port", "465");
                          Session session = Session.getDefaultInstance(props,
                                              new javax.mail.Authenticator() {
                                                        protected PasswordAuthentication getPasswordAuthentication() {
                                                                  return new PasswordAuthentication("test@gmail.com",
                          try {
                                    Message message = new MimeMessage(session);
                                    message.setFrom(new InternetAddress("test@gmail.com"));
                                    message.setSubject("Testing Subject");
                                    message.setText("Test message text!");
                          } catch (MessagingException e) {
                                    throw new RuntimeException(e);