You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2004/06/08 10:47:21 UTC

DO NOT REPLY [Bug 29435] New: - pop3 before smtp

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=29435>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=29435

pop3 before smtp

           Summary: pop3 before smtp
           Product: Commons
           Version: unspecified
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: Sandbox
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: mailings@matthias-wessendorf.de


daniel perry added a method, that allows
pop3-Authorization 

i created a patch:

Index: Email.java
===================================================================
RCS file:
/home/cvspublic/jakarta-commons-sandbox/email/src/java/org/apache/commons/mail/Email.java,v
retrieving revision 1.15
diff -u -r1.15 Email.java
--- Email.java	19 Feb 2004 22:38:09 -0000	1.15
+++ Email.java	8 Jun 2004 08:36:54 -0000
@@ -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