View Javadoc
1 package org.hedwig.core; 2 import javax.mail.*; 3 4 5 public class MailAccount extends RemoteAccount { 6 7 private Store _store; 8 private static Session _session; 9 10 static { 11 _session= Session.getDefaultInstance(System.getProperties()); 12 } 13 class MailAuthenticator extends Authenticator { 14 protected PasswordAuthentication getPasswordAuthentication() { 15 return new PasswordAuthentication(getUserName(), getPass()); 16 } 17 } 18 19 /*** 20 * Constructor for MailAccount. 21 */ 22 public MailAccount() { 23 super(); 24 } 25 /* ignore these methods for now; they'll probably be moving soon */ 26 public void connect() { 27 try { 28 _store= _session.getStore(new URLName("pop3", getServer(), -1, null, getUserName(), getPass())); 29 _store.connect(); 30 31 } catch (NoSuchProviderException e) { 32 System.out.println("bad provider"); 33 }catch (MessagingException e){ 34 System.out.println("messaging exception"); 35 } 36 } 37 public void disconnect(){ 38 try { 39 _store.close(); 40 } catch (MessagingException e) { 41 } 42 } 43 44 public boolean isConnected() { 45 return _store.isConnected(); 46 } 47 }

This page was automatically generated by Maven