test_class.file: server/src/test/java/com/abiquo/mailman/MailManagerTest.java
test_class.identifier: MailManagerTest
test_class.superclass: extends MailTestBase
test_case.body: @Test
      public final void testSendArrayOfAddresses()
      {
          try
          {
              Set<String> to = new HashSet<String>();
              Set<String> cc = new HashSet<String>();
              to.add(mailTo);
              cc.add(mailCC);
              mail.send(mailUser, to, cc, mailSubject, mailBody);
          }
          catch (Exception e)
          {
              e.printStackTrace();
              fail("Exception raised:" + e.toString());
          }
      }
test_case.class_method_signature: MailManagerTest.testSendArrayOfAddresses()
test_case.full_signature: @Test public final void testSendArrayOfAddresses()
test_case.identifier: testSendArrayOfAddresses
test_case.invocations: add add send printStackTrace fail toString
test_case.modifiers: @Test public final
test_case.parameters: ()
test_case.return: void
test_case.signature: void testSendArrayOfAddresses()
focal_class.declarator: logger = LoggerFactory.getLogger(MailManager.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger logger = LoggerFactory.getLogger(MailManager.class);
focal_class.type: Logger
focal_class.var_name: logger
focal_class.declarator: DEFAULT_TRANSPORT = "smtp"
focal_class.modifier: private static final
focal_class.original_string: private static final String DEFAULT_TRANSPORT = "smtp";
focal_class.type: String
focal_class.var_name: DEFAULT_TRANSPORT
focal_class.declarator: BAD_JNDI_ERROR = "Bad JNDI Error."
focal_class.modifier: private static final
focal_class.original_string: private static final String BAD_JNDI_ERROR = "Bad JNDI Error.";
focal_class.type: String
focal_class.var_name: BAD_JNDI_ERROR
focal_class.declarator: BAD_INTERNET_ADDRESS_ERROR = "Bad Internet Address error."
focal_class.modifier: private static final
focal_class.original_string: private static final String BAD_INTERNET_ADDRESS_ERROR = "Bad Internet Address error.";
focal_class.type: String
focal_class.var_name: BAD_INTERNET_ADDRESS_ERROR
focal_class.declarator: DEFAULT_ENCODING = "UTF-8"
focal_class.modifier: private static final
focal_class.original_string: private static final String DEFAULT_ENCODING = "UTF-8";
focal_class.type: String
focal_class.var_name: DEFAULT_ENCODING
focal_class.declarator: MAIL_SMTP_AUTH = "mail.smtp.auth"
focal_class.modifier: private static final
focal_class.original_string: private static final String MAIL_SMTP_AUTH = "mail.smtp.auth";
focal_class.type: String
focal_class.var_name: MAIL_SMTP_AUTH
focal_class.declarator: session_ = null
focal_class.modifier: private
focal_class.original_string: private Session session_ = null;
focal_class.type: Session
focal_class.var_name: session_
focal_class.declarator: host_
focal_class.modifier: private
focal_class.original_string: private String host_, username_, password_, encoding_;
focal_class.type: String
focal_class.var_name: host_
focal_class.declarator: isSmtpAuthentication = true
focal_class.modifier: private
focal_class.original_string: private Boolean isSmtpAuthentication = true;
focal_class.type: Boolean
focal_class.var_name: isSmtpAuthentication
focal_class.declarator: isTls = true
focal_class.modifier: private
focal_class.original_string: private Boolean isTls = true;
focal_class.type: Boolean
focal_class.var_name: isTls
focal_class.declarator: isSsl = true
focal_class.modifier: private
focal_class.original_string: private Boolean isSsl = true;
focal_class.type: Boolean
focal_class.var_name: isSsl
focal_class.declarator: sslPort = 443
focal_class.modifier: private
focal_class.original_string: private Integer sslPort = 443;
focal_class.type: Integer
focal_class.var_name: sslPort
focal_class.declarator: STRICT_EMAIL_CHECK = true
focal_class.modifier: private final static
focal_class.original_string: private final static boolean STRICT_EMAIL_CHECK = true;
focal_class.type: boolean
focal_class.var_name: STRICT_EMAIL_CHECK
focal_class.declarator: instance
focal_class.modifier: private static
focal_class.original_string: private static MailManager instance;
focal_class.type: MailManager
focal_class.var_name: instance
focal_class.file: server/src/main/java/com/abiquo/mailman/MailManager.java
focal_class.identifier: MailManager
focal_class.class_method_signature: MailManager.MailManager(String host, String username, String password, String encoding,
          Boolean isAuth, Boolean isTls, Boolean isSsl, Integer sslPort)
focal_class.full_signature: protected  MailManager(String host, String username, String password, String encoding,
          Boolean isAuth, Boolean isTls, Boolean isSsl, Integer sslPort)
focal_class.identifier: MailManager
focal_class.modifiers: protected
focal_class.parameters: (String host, String username, String password, String encoding,
          Boolean isAuth, Boolean isTls, Boolean isSsl, Integer sslPort)
focal_class.signature:  MailManager(String host, String username, String password, String encoding,
          Boolean isAuth, Boolean isTls, Boolean isSsl, Integer sslPort)
focal_class.class_method_signature: MailManager.MailManager(String host, String username, String password, String encoding,
          Boolean isAuth, Boolean isTls)
focal_class.full_signature: protected  MailManager(String host, String username, String password, String encoding,
          Boolean isAuth, Boolean isTls)
focal_class.identifier: MailManager
focal_class.modifiers: protected
focal_class.parameters: (String host, String username, String password, String encoding,
          Boolean isAuth, Boolean isTls)
focal_class.signature:  MailManager(String host, String username, String password, String encoding,
          Boolean isAuth, Boolean isTls)
focal_class.class_method_signature: MailManager.MailManager(String host, String username, String password, String encoding,
          Boolean isAuth)
focal_class.full_signature: protected  MailManager(String host, String username, String password, String encoding,
          Boolean isAuth)
focal_class.identifier: MailManager
focal_class.modifiers: protected
focal_class.parameters: (String host, String username, String password, String encoding,
          Boolean isAuth)
focal_class.signature:  MailManager(String host, String username, String password, String encoding,
          Boolean isAuth)
focal_class.class_method_signature: MailManager.MailManager(String host, String username, String password, String encoding)
focal_class.full_signature: protected  MailManager(String host, String username, String password, String encoding)
focal_class.identifier: MailManager
focal_class.modifiers: protected
focal_class.parameters: (String host, String username, String password, String encoding)
focal_class.signature:  MailManager(String host, String username, String password, String encoding)
focal_class.class_method_signature: MailManager.MailManager(String host, String username, String password)
focal_class.full_signature: private  MailManager(String host, String username, String password)
focal_class.identifier: MailManager
focal_class.modifiers: private
focal_class.parameters: (String host, String username, String password)
focal_class.signature:  MailManager(String host, String username, String password)
focal_class.class_method_signature: MailManager.instance()
focal_class.full_signature: public static synchronized MailManager instance()
focal_class.identifier: instance
focal_class.modifiers: public static synchronized
focal_class.parameters: ()
focal_class.return: MailManager
focal_class.signature: MailManager instance()
focal_class.class_method_signature: MailManager.send(String from, Set<String> addressListTO, Set<String> addressListCC,
          String subject, String body)
focal_class.full_signature: public String send(String from, Set<String> addressListTO, Set<String> addressListCC,
          String subject, String body)
focal_class.identifier: send
focal_class.modifiers: public
focal_class.parameters: (String from, Set<String> addressListTO, Set<String> addressListCC,
          String subject, String body)
focal_class.return: String
focal_class.signature: String send(String from, Set<String> addressListTO, Set<String> addressListCC,
          String subject, String body)
focal_class.class_method_signature: MailManager.send(String mailFrom, String mailTo, String mailCc, String subject, String body)
focal_class.full_signature: public String send(String mailFrom, String mailTo, String mailCc, String subject, String body)
focal_class.identifier: send
focal_class.modifiers: public
focal_class.parameters: (String mailFrom, String mailTo, String mailCc, String subject, String body)
focal_class.return: String
focal_class.signature: String send(String mailFrom, String mailTo, String mailCc, String subject, String body)
focal_class.class_method_signature: MailManager.send(String mailFrom, String mailTo, String subject, String body)
focal_class.full_signature: public String send(String mailFrom, String mailTo, String subject, String body)
focal_class.identifier: send
focal_class.modifiers: public
focal_class.parameters: (String mailFrom, String mailTo, String subject, String body)
focal_class.return: String
focal_class.signature: String send(String mailFrom, String mailTo, String subject, String body)
focal_class.class_method_signature: MailManager.sendFromMailUser(String mailTo, String mailCc, String subject, String body)
focal_class.full_signature: public String sendFromMailUser(String mailTo, String mailCc, String subject, String body)
focal_class.identifier: sendFromMailUser
focal_class.modifiers: public
focal_class.parameters: (String mailTo, String mailCc, String subject, String body)
focal_class.return: String
focal_class.signature: String sendFromMailUser(String mailTo, String mailCc, String subject, String body)
focal_class.class_method_signature: MailManager.sendFromMailUser(String mailTo, String subject, String body)
focal_class.full_signature: public String sendFromMailUser(String mailTo, String subject, String body)
focal_class.identifier: sendFromMailUser
focal_class.modifiers: public
focal_class.parameters: (String mailTo, String subject, String body)
focal_class.return: String
focal_class.signature: String sendFromMailUser(String mailTo, String subject, String body)
focal_class.class_method_signature: MailManager.getMailSession()
focal_class.full_signature: private Session getMailSession()
focal_class.identifier: getMailSession
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: Session
focal_class.signature: Session getMailSession()
focal_method.body: public String send(String from, Set<String> addressListTO, Set<String> addressListCC,
          String subject, String body) throws MailException
      {
          StringBuilder errorBuilder = new StringBuilder();
  
          try
          {
              // Creating the message
              MimeMessage myMessage = new MimeMessage(this.getMailSession());
  
              // Setting the parts of the message ////////////////////////////////
              // Setting the subject of the message. Uses the in parameter subject
              myMessage.setSubject(subject, encoding_);
  
              // Set from in the emails depending on the brand.
              if ((from != null) && !from.equals(""))
              {
                  myMessage.setFrom(new InternetAddress(from, STRICT_EMAIL_CHECK));
              }
  
              MimeBodyPart mbp1 = new MimeBodyPart();
              mbp1.setText(body, encoding_);
  
              Multipart mp = new MimeMultipart();
              mp.addBodyPart(mbp1);
  
              myMessage.setContent(mp);
  
              // Setting the TO addresses of the receivers
              for (String addr : addressListTO)
              {
                  try
                  {
  
                      Address addressAux = new InternetAddress(addr, STRICT_EMAIL_CHECK);
                      myMessage.addRecipient(Message.RecipientType.TO, addressAux);
  
                  }
                  // capture any malformed address
                  catch (AddressException addEx)
                  {
                      final String cause =
                          String.format("Invalid email address TO [%s] caused by [%s]", addr,
                              addEx.getLocalizedMessage());
                      errorBuilder.append(cause);
                  }
              }
  
              // Setting the CC addresses of the receivers
              if (addressListCC != null)
              {
  
                  for (String addr : addressListCC)
                  {
                      try
                      {
  
                          Address addressAux = new InternetAddress(addr, STRICT_EMAIL_CHECK);
                          myMessage.addRecipient(Message.RecipientType.CC, addressAux);
                      }
                      // capture any malformed address
                      catch (AddressException addEx)
                      {
                          final String cause =
                              String.format("Invalid email address CC [%s] caused by [%s]", addr,
                                  addEx.getLocalizedMessage());
  
                          errorBuilder.append(cause);
                      }
                  }
              }
  
              // Send the message to receivers
              Transport tr = session_.getTransport(MailManager.DEFAULT_TRANSPORT);
              tr.connect(host_, username_, password_);
              myMessage.saveChanges(); // don't forget this
              tr.sendMessage(myMessage, myMessage.getAllRecipients());
              tr.close();
  
          }
          // catch (javax.mail.internet.AddressException exc)
          // {
          // throw new MailException(MailManager.BAD_MAIL_ADDRESS_ERROR, exc);
          // }
          catch (AddressException ae)
          {
              throw new MailException(MailManager.BAD_INTERNET_ADDRESS_ERROR, ae);
          }
          catch (javax.mail.MessagingException exc)
          {
              throw new MailException(MailManager.BAD_INTERNET_ADDRESS_ERROR, exc);
          }
          catch (javax.naming.NamingException exc)
          {
              throw new MailException(MailManager.BAD_JNDI_ERROR, exc);
          }
  
          return errorBuilder.toString();
      }
focal_method.class_method_signature: MailManager.send(String from, Set<String> addressListTO, Set<String> addressListCC,
          String subject, String body)
focal_method.full_signature: public String send(String from, Set<String> addressListTO, Set<String> addressListCC,
          String subject, String body)
focal_method.identifier: send
focal_method.invocations: getMailSession setSubject equals setFrom setText addBodyPart setContent addRecipient format getLocalizedMessage append addRecipient format getLocalizedMessage append getTransport connect saveChanges sendMessage getAllRecipients close toString
focal_method.modifiers: public
focal_method.parameters: (String from, Set<String> addressListTO, Set<String> addressListCC,
          String subject, String body)
focal_method.return: String
focal_method.signature: String send(String from, Set<String> addressListTO, Set<String> addressListCC,
          String subject, String body)