1 25 29 package org.jresearch.gossip.mail; 30 31 import java.io.IOException ; 32 33 import javax.mail.Authenticator ; 34 import javax.mail.PasswordAuthentication ; 35 36 import org.jresearch.gossip.IConst; 37 import org.jresearch.gossip.configuration.Configurator; 38 import org.jresearch.gossip.exception.ConfiguratorException; 39 import org.jresearch.gossip.util.DesEncrypter; 40 41 46 public class SmtpAuthenticator extends Authenticator { 47 private static Configurator config = Configurator.getInstance(); 48 49 private String mailuser; 50 51 private String mailpassword; 52 53 59 public SmtpAuthenticator() throws ConfiguratorException, IOException { 60 super(); 61 62 DesEncrypter encrypter = new DesEncrypter(IConst.VALUES.ENCRYPTER_KEY); 63 mailuser = config.get(IConst.CONFIG.MAILUSER); 64 mailpassword = encrypter 65 .decrypt(config.get(IConst.CONFIG.MAILPASSWORD)); 66 67 } 68 69 74 protected PasswordAuthentication getPasswordAuthentication() { 75 return new PasswordAuthentication (mailuser, mailpassword); 76 } 77 } 78 | Popular Tags |