Package javax.mail

Examples of javax.mail.Session


          else
          {
            // TODO HARDCODED SMTP HOST!!
            props.put("mail.smtp.host", "minsksrv");
          }
          Session session                 = Session.getDefaultInstance(props, null);
          MimeMessage message             = new MimeMessage(session);

          ArrayList to                    = mailmessage.getTo();
          String arrayto[]                  = new String[to.size()];
          for (int i = 0; i < arrayto.length; i++)
View Full Code Here


  }

  public static void performBursting(final MailDefinition definition)
      throws ReportProcessingException, MessagingException, ContentIOException
  {
    final Session session = Session.getInstance(definition.getSessionProperties(), definition.getAuthenticator());
    performBursting(definition, session);
  }
View Full Code Here

      MailSession mailSession = new MailSession();

      mailSession.create();

      Session session = null;

      try
      {
         session = mailSession.getSession();
      }
      catch (NamingException e)
      {
         assert false;
         // Naming exception can't occur if we aren't getting the Session from
         // JNDI
      }

      assert DEFAULT_HOST.equals(session.getProperty("mail.smtp.host"));

      int port = 0;

      try
      {
         port = Integer.parseInt(session.getProperty("mail.smtp.port"));
      }
      catch (NumberFormatException e)
      {
         assert false;
      }

      assert port == DEFAULT_PORT;

      assert "smtp".equals(session.getProperty("mail.transport.protocol"));
     
      SMTPTransport transport = null;

      try
      {
         assert session.getTransport() instanceof SMTPTransport;
         transport = (SMTPTransport) session.getTransport();
      }
      catch (NoSuchProviderException e)
      {
         assert false;
      }

      assert !session.getDebug();

      assert transport.getStartTLS();

   }
View Full Code Here

      mailSession.setPort(PORT);
      mailSession.setDebug(true);

      mailSession.create();

      Session session = null;

      try
      {
         session = mailSession.getSession();
      }
      catch (NamingException e)
      {
         assert false;
         // Naming exception can't occur if we aren't getting the Session from
         // JNDI
      }

      assert HOST.equals(session.getProperty("mail.smtp.host"));

      int port = 0;

      try
      {
         port = Integer.parseInt(session.getProperty("mail.smtp.port"));
      }
      catch (NumberFormatException e)
      {
         assert false;
      }

      assert port == PORT;

      try
      {
         assert session.getTransport() instanceof SMTPTransport;
      }
      catch (NoSuchProviderException e)
      {
         assert false;
      }

      assert session.getDebug();

   }
View Full Code Here

      mailSession.setUsername(USERNAME);
      mailSession.setPassword(PASSWORD);

      mailSession.create();

      Session session = null;

      try
      {
         session = mailSession.getSession();
      }
      catch (NamingException e)
      {
         assert false;
         // Naming exception can't occur if we aren't getting the Session from
         // JNDI
      }

      assert Boolean.parseBoolean(session.getProperty("mail.smtp.auth"));

      // TODO Check authentication

   }
View Full Code Here

      MailSession mailSession = new MailSession();
      mailSession.setUsername(USERNAME);

      mailSession.create();

      Session session = null;

      try
      {
         session = mailSession.getSession();
      }
      catch (NamingException e)
      {
         assert false;
         // Naming exception can't occur if we aren't getting the Session from
         // JNDI
      }

      assert null == session.getProperty("mail.smtp.auth");

   }
View Full Code Here

      MailSession mailSession = new MailSession();
      mailSession.setPassword(PASSWORD);

      mailSession.create();

      Session session = null;

      try
      {
         session = mailSession.getSession();
      }
      catch (NamingException e)
      {
         assert false;
         // Naming exception can't occur if we aren't getting the Session from
         // JNDI
      }

      assert null == session.getProperty("mail.smtp.auth");

   }
View Full Code Here

     
      mailSession.setSsl(true);

      mailSession.create();

      Session session = null;

      try
      {
         session = mailSession.getSession();
      }
      catch (NamingException e)
      {
         assert false;
         // Naming exception can't occur if we aren't getting the Session from
         // JNDI
      }

      assert "smtps".equals(session.getProperty("mail.transport.protocol"));
     
      SMTPSSLTransport transport = null;

      try
      {
         assert session.getTransport() instanceof SMTPSSLTransport;
         transport = (SMTPSSLTransport) session.getTransport();
      }
      catch (NoSuchProviderException e)
      {
         assert false;
      }
    
      int port = 0;
     
      try
      {
         port = Integer.parseInt(session.getProperty("mail.smtps.port"));
      }
      catch (NumberFormatException e)
      {
         assert false;
      }

      assert port == DEFAULT_SSL_PORT;
     
      assert DEFAULT_HOST.equals(session.getProperty("mail.smtps.host"));
     
      assert !session.getDebug();
     
      // TLS not used over SSL
      assert !transport.getStartTLS();

   }
View Full Code Here

      mailSession.setSsl(true);
      mailSession.setPort(PORT);

      mailSession.create();

      Session session = null;

      try
      {
         session = mailSession.getSession();
      }
      catch (NamingException e)
      {
         assert false;
         // Naming exception can't occur if we aren't getting the Session from
         // JNDI
      }
    
      int port = 0;
     
      try
      {
         port = Integer.parseInt(session.getProperty("mail.smtps.port"));
      }
      catch (NumberFormatException e)
      {
         assert false;
      }
View Full Code Here

      mailSession.setPassword(PASSWORD);
      mailSession.setSsl(true);

      mailSession.create();

      Session session = null;

      try
      {
         session = mailSession.getSession();
      }
      catch (NamingException e)
      {
         assert false;
         // Naming exception can't occur if we aren't getting the Session from
         // JNDI
      }

      assert Boolean.parseBoolean(session.getProperty("mail.smtps.auth"));
      assert session.getProperty("mail.smtp.auth") == null;

      // TODO Check authentication

   }
View Full Code Here

TOP

Related Classes of javax.mail.Session

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.