1 17 package org.openbravo.erpCommon.businessUtility; 18 19 import javax.mail.Authenticator ; 20 import javax.mail.PasswordAuthentication ; 21 import org.apache.log4j.Logger ; 22 23 public class EMailAuthenticator extends Authenticator { 24 static Logger log4j = Logger.getLogger(EMailAuthenticator.class); 25 26 private PasswordAuthentication m_pass; 27 28 public EMailAuthenticator(String username, String password) { 29 m_pass = new PasswordAuthentication (username, password); 30 if(username == null || username.length() == 0) { 31 log4j.error("EMailAuthenticator - Username is NULL"); 32 Thread.dumpStack(); 33 } 34 if(password == null || password.length() == 0) { 35 log4j.error("EMailAuthenticator - Password is NULL"); 36 Thread.dumpStack(); 37 } 38 } 39 40 protected PasswordAuthentication getPasswordAuthentication() { 41 return m_pass; 42 } 43 44 public String toString() { 45 if(m_pass == null) 46 return "EMailAuthenticator[]"; 47 else 48 return "EMailAuthenticator[" + m_pass.getUserName() + "/" + m_pass.getPassword() + "]"; 49 } 50 } 51 | Popular Tags |