1 Reply Latest reply on Dec 27, 2012 2:33 AM by nickarls

    Mailing code fails when running over the server

    iapazmino

      Hi,

       

      I have some very simple code to send an email using the Java Mail API.

       

          public void send(final Email email) throws MessagingException {
              final Properties smtpConfig = readSmtpConfig();
              final Session session = startSessionFor(smtpConfig);
              final Message message = composeNewMessage(session, email);
      
              send(message);
          }
      

       

      The configuration is read from a file, the session is started using a username and a password, the message is composed coping some fields from a pre-loaded email class and send just invokes

       

      Transport.send(message);
      

       

      This works just fine if the class is invoked from JUnit, but when I try to run it from the server it doesn't work and doesn't throw any exception either.

       

      I don't use at all the server descriptor standalone.xml because I need to be able to modify the properties file at runtime.

       

      Any ideas what should I try to at least get an exception?

       

      Thanks in advance.