commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mat...@apache.org
Subject cvs commit: jakarta-commons-sandbox/email/src/java/org/apache/commons/mail Email.java
Date Fri, 27 Aug 2004 11:43:14 GMT
matzew      2004/08/27 04:43:14

  Modified:    email/src/java/org/apache/commons/mail Email.java
  Log:
  subbmitted patch for bug-entrie #29435
  for supporting popBeforeSMTP
  
  Revision  Changes    Path
  1.16      +35 -5     jakarta-commons-sandbox/email/src/java/org/apache/commons/mail/Email.java
  
  Index: Email.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/email/src/java/org/apache/commons/mail/Email.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- Email.java	19 Feb 2004 22:38:09 -0000	1.15
  +++ Email.java	27 Aug 2004 11:43:14 -0000	1.16
  @@ -26,6 +26,7 @@
   import javax.mail.Message;
   import javax.mail.MessagingException;
   import javax.mail.Session;
  +import javax.mail.Store;
   import javax.mail.Transport;
   import javax.mail.internet.InternetAddress;
   import javax.mail.internet.MimeMessage;
  @@ -131,7 +132,15 @@
        * Disposition-Notification-To: user@domain.net
        */
       private Hashtable headers = null;
  -
  +    
  +    /**
  +     * Used to determine wether to use pop3 before smtp, and if so the settings.
  +     */
  +    private boolean popBeforeSmtp = false;
  +    private String popHost = null;
  +    private String popUsername = null;
  +    private String popPassword = null;
  +    
       /**
        * Setting to true will enable the display of debug information.
        *
  @@ -280,7 +289,7 @@
       public Email setFrom(String email)
               throws MessagingException
       {
  -        return setFrom(email, null);
  +       return setFrom(email, null);
       }
   
       /**
  @@ -629,7 +638,8 @@
       public void send()
               throws MessagingException
       {
  -        Session session = getMailSession();
  +    	
  + 	    Session session = getMailSession();
           MimeMessage message = new MimeMessage(session);
   
           if (subject != null)
  @@ -715,6 +725,11 @@
           {
               message.setSentDate(getSentDate());
           }
  +        
  +        if (popBeforeSmtp){
  +            Store store = session.getStore("pop3");
  +            store.connect(popHost, popUsername, popPassword);
  +        }
   
           Transport.send(message);
       }
  @@ -754,4 +769,19 @@
   
           return ia;
       }
  -}
  +    
  +    /**
  +     * Set details regarding "pop3 before smtp" authentication
  +     * @param popBeforeSmtp Wether or not to log into pop3 server before sending mail
  +     * @param popHost The pop3 host to use.
  +     * @param popUsername The pop3 username.
  +     * @param popPassword The pop3 password.
  +     */
  +    public void setPopBeforeSmtp(boolean popBeforeSmtp, String popHost, String popUsername,
String popPassword){
  +        this.popBeforeSmtp=popBeforeSmtp;
  +        this.popHost=popHost;
  +        this.popUsername=popUsername;
  +        this.popPassword=popPassword;
  +    }
  +
  +}
  \ No newline at end of file
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message