geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r351866 - in /geronimo/trunk: modules/javamail-transport/ modules/javamail-transport/src/ modules/javamail-transport/src/java/ modules/javamail-transport/src/java/org/ modules/javamail-transport/src/java/org/apache/ modules/javamail-transpo...
Date Sat, 03 Dec 2005 01:12:21 GMT
Author: dain
Date: Fri Dec  2 17:12:14 2005
New Revision: 351866

URL: http://svn.apache.org/viewcvs?rev=351866&view=rev
Log:
Moved SMTP javamail transport out of sandbox and into modules/javamail-transport
Removed cruft from sandbox mail

Added:
    geronimo/trunk/modules/javamail-transport/   (with props)
    geronimo/trunk/modules/javamail-transport/LICENSE.txt   (with props)
    geronimo/trunk/modules/javamail-transport/NOTICE.txt   (with props)
    geronimo/trunk/modules/javamail-transport/project.xml   (with props)
    geronimo/trunk/modules/javamail-transport/src/
    geronimo/trunk/modules/javamail-transport/src/java/
    geronimo/trunk/modules/javamail-transport/src/java/org/
    geronimo/trunk/modules/javamail-transport/src/java/org/apache/
    geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/
    geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail/
    geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail/transport/
    geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail/transport/smtp/
      - copied from r351823, geronimo/trunk/sandbox/mail/src/java/org/apache/geronimo/mail/smtp/
    geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail/transport/smtp/MalformedSMTPReplyException.java
      - copied, changed from r351864, geronimo/trunk/sandbox/mail/src/java/org/apache/geronimo/mail/smtp/MalformedSMTPReplyException.java
    geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail/transport/smtp/SMTPReply.java
      - copied, changed from r351864, geronimo/trunk/sandbox/mail/src/java/org/apache/geronimo/mail/smtp/SMTPReply.java
    geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail/transport/smtp/SMTPTransport.java
      - copied, changed from r351864, geronimo/trunk/sandbox/mail/src/java/org/apache/geronimo/mail/smtp/SMTPTransport.java
    geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail/transport/smtp/SMTPTransportException.java
      - copied, changed from r351864, geronimo/trunk/sandbox/mail/src/java/org/apache/geronimo/mail/smtp/SMTPTransportException.java
    geronimo/trunk/modules/javamail-transport/src/resources/
    geronimo/trunk/modules/javamail-transport/src/resources/META-INF/
    geronimo/trunk/modules/javamail-transport/src/resources/META-INF/javamail.default.address.map
      - copied, changed from r351823, geronimo/trunk/sandbox/mail/src/resources/META-INF/javamail.default.address.map
    geronimo/trunk/modules/javamail-transport/src/resources/META-INF/javamail.default.providers
      - copied, changed from r351823, geronimo/trunk/sandbox/mail/src/resources/META-INF/javamail.default.providers
Removed:
    geronimo/trunk/sandbox/mail/src/java/org/apache/geronimo/mail/AbstractTransport.java
    geronimo/trunk/sandbox/mail/src/java/org/apache/geronimo/mail/smtp/
    geronimo/trunk/sandbox/mail/src/test/
    geronimo/trunk/sandbox/mail/xdocs/

Propchange: geronimo/trunk/modules/javamail-transport/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Dec  2 17:12:14 2005
@@ -0,0 +1,6 @@
+*.iml
+.project
+.classpath
+maven.log
+junit*.properties
+target

Added: geronimo/trunk/modules/javamail-transport/LICENSE.txt
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/javamail-transport/LICENSE.txt?rev=351866&view=auto
==============================================================================
--- geronimo/trunk/modules/javamail-transport/LICENSE.txt (added)
+++ geronimo/trunk/modules/javamail-transport/LICENSE.txt Fri Dec  2 17:12:14 2005
@@ -0,0 +1,203 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+

Propchange: geronimo/trunk/modules/javamail-transport/LICENSE.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/trunk/modules/javamail-transport/NOTICE.txt
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/javamail-transport/NOTICE.txt?rev=351866&view=auto
==============================================================================
--- geronimo/trunk/modules/javamail-transport/NOTICE.txt (added)
+++ geronimo/trunk/modules/javamail-transport/NOTICE.txt Fri Dec  2 17:12:14 2005
@@ -0,0 +1,3 @@
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+

Propchange: geronimo/trunk/modules/javamail-transport/NOTICE.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/trunk/modules/javamail-transport/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/javamail-transport/project.xml?rev=351866&view=auto
==============================================================================
--- geronimo/trunk/modules/javamail-transport/project.xml (added)
+++ geronimo/trunk/modules/javamail-transport/project.xml Fri Dec  2 17:12:14 2005
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Copyright 2004 The Apache Software Foundation
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+  
+       http://www.apache.org/licenses/LICENSE-2.0
+  
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+  
+
+<!-- $Rev:$ $Date:$ -->
+
+<project>
+    <pomVersion>3</pomVersion>
+    <extend>../../etc/project.xml</extend>
+
+    <name>Geronimo :: JavaMail Transport</name>
+    <id>geronimo-javamail-transport</id>
+    <shortDescription>Geronimo JavaMail Transport</shortDescription>
+    <description>Geronimo JavaMail Transport</description>
+    <siteDirectory></siteDirectory>
+    <distributionDirectory></distributionDirectory>
+
+    <package>org.apache.geronimo.javamail.transport</package>
+
+    <!-- ============ -->
+    <!-- Dependencies -->
+    <!-- ============ -->
+
+    <dependencies>
+        <dependency>
+            <groupId>geronimo-spec</groupId>
+            <artifactId>geronimo-spec-activation</artifactId>
+            <version>${geronimo_spec_activation_version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>geronimo-spec</groupId>
+            <artifactId>geronimo-spec-javamail</artifactId>
+            <version>${geronimo_spec_javamail_version}</version>
+        </dependency>
+    </dependencies>
+</project>

Propchange: geronimo/trunk/modules/javamail-transport/project.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail/transport/smtp/MalformedSMTPReplyException.java
(from r351864, geronimo/trunk/sandbox/mail/src/java/org/apache/geronimo/mail/smtp/MalformedSMTPReplyException.java)
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail/transport/smtp/MalformedSMTPReplyException.java?p2=geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail/transport/smtp/MalformedSMTPReplyException.java&p1=geronimo/trunk/sandbox/mail/src/java/org/apache/geronimo/mail/smtp/MalformedSMTPReplyException.java&r1=351864&r2=351866&rev=351866&view=diff
==============================================================================
--- geronimo/trunk/sandbox/mail/src/java/org/apache/geronimo/mail/smtp/MalformedSMTPReplyException.java
(original)
+++ geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail/transport/smtp/MalformedSMTPReplyException.java
Fri Dec  2 17:12:14 2005
@@ -15,15 +15,14 @@
  *  limitations under the License.
  */
 
-package org.apache.geronimo.mail.smtp;
+package org.apache.geronimo.javamail.transport.smtp;
 
 /**
- *  Exception for when a SMTP reply string has a problem
+ * Exception for when a SMTP reply string has a problem
  * 
- * @version $Id: $
+ * @version $Rev$ $Date$
  */
 class MalformedSMTPReplyException  extends Exception {
-
     MalformedSMTPReplyException() {
         super();
     }

Copied: geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail/transport/smtp/SMTPReply.java
(from r351864, geronimo/trunk/sandbox/mail/src/java/org/apache/geronimo/mail/smtp/SMTPReply.java)
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail/transport/smtp/SMTPReply.java?p2=geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail/transport/smtp/SMTPReply.java&p1=geronimo/trunk/sandbox/mail/src/java/org/apache/geronimo/mail/smtp/SMTPReply.java&r1=351864&r2=351866&rev=351866&view=diff
==============================================================================
--- geronimo/trunk/sandbox/mail/src/java/org/apache/geronimo/mail/smtp/SMTPReply.java (original)
+++ geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail/transport/smtp/SMTPReply.java
Fri Dec  2 17:12:14 2005
@@ -15,26 +15,20 @@
  *  limitations under the License.
  */
 
-package org.apache.geronimo.mail.smtp;
+package org.apache.geronimo.javamail.transport.smtp;
 
 /**
  * Util class to represent a reply from a SMTP server
  *
- * @version $Id: $
+ * @version $Rev$ $Date$
  */
 class SMTPReply {
-
     private final int code;
     private final String message;
     private final char firstChar;
 
-    SMTPReply(String s)
-        throws MalformedSMTPReplyException{
-
-        /*
-         * first three must be the return code
-         */
-
+    SMTPReply(String s) throws MalformedSMTPReplyException {
+        // first three must be the return code
         if (s == null || s.length() < 3) {
             throw new MalformedSMTPReplyException("Too Short! : " + s);
         }
@@ -43,17 +37,13 @@
             firstChar = s.charAt(0);
             code = Integer.parseInt(s.substring(0, 3));
 
-            /*
-             * message should be separated by a space
-             */
+            // message should be separated by a space
             if (s.length() > 4) {
                 message = s.substring(4);
-            }
-            else {
+            } else {
                 message = "";
             }
-        }
-        catch (NumberFormatException e) {
+        } catch (NumberFormatException e) {
             throw new MalformedSMTPReplyException("error in parsing code", e);
         }
     }
@@ -67,9 +57,7 @@
     }
 
     /**
-     *  Indicates if reply is an error condition
-     *
-     * @return
+     * Indicates if reply is an error condition
      */
     boolean isError() {
         if (firstChar == '5' || firstChar == '4') {

Copied: geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail/transport/smtp/SMTPTransport.java
(from r351864, geronimo/trunk/sandbox/mail/src/java/org/apache/geronimo/mail/smtp/SMTPTransport.java)
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail/transport/smtp/SMTPTransport.java?p2=geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail/transport/smtp/SMTPTransport.java&p1=geronimo/trunk/sandbox/mail/src/java/org/apache/geronimo/mail/smtp/SMTPTransport.java&r1=351864&r2=351866&rev=351866&view=diff
==============================================================================
--- geronimo/trunk/sandbox/mail/src/java/org/apache/geronimo/mail/smtp/SMTPTransport.java
(original)
+++ geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail/transport/smtp/SMTPTransport.java
Fri Dec  2 17:12:14 2005
@@ -15,62 +15,52 @@
  *  limitations under the License.
  */
 
-package org.apache.geronimo.mail.smtp;
+package org.apache.geronimo.javamail.transport.smtp;
 
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.Socket;
+import java.net.SocketException;
+import java.net.UnknownHostException;
 import javax.mail.Address;
 import javax.mail.Message;
 import javax.mail.MessagingException;
 import javax.mail.Session;
-import javax.mail.Transport;
 import javax.mail.URLName;
-import javax.mail.internet.MimeMessage;
-import javax.mail.internet.InternetAddress;
-import javax.mail.internet.MimeMultipart;
-import javax.mail.internet.MimeBodyPart;
-
-import org.apache.geronimo.mail.AbstractTransport;
-
-import java.net.Socket;
-import java.net.InetSocketAddress;
-import java.net.SocketException;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.Properties;
-import java.util.Date;
+import javax.mail.Transport;
 
 /**
- *  Simple implementation of SMTP transport.  Just does plain RFC821-ish
- *  delivery.
- *
- *  Supported properties :
- *
- *  <ul>
- *  <li> mail.host : to set the server to deliver to.  Default = localhost</li>
- *  <li> mail.smtp.port : to set the port.  Default = 25</li>
- *  <li> mail.smtp.locahost : name to use for HELO/EHLO - default getHostName()</li>
- *  </ul>
- *
- *  There is no way to indicate failure for a given recipient (it's possible to have a
- *  recipient address rejected).  The sun impl throws exceptions even if others successful),
- *  but maybe we do a different way...
- *
- *  TODO : lots.  ESMTP, user/pass, indicate failure, etc...
+ * Simple implementation of SMTP transport.  Just does plain RFC821-ish
+ * delivery.
+ * <p/>
+ * Supported properties :
+ * <p/>
+ * <ul>
+ * <li> mail.host : to set the server to deliver to.  Default = localhost</li>
+ * <li> mail.smtp.port : to set the port.  Default = 25</li>
+ * <li> mail.smtp.locahost : name to use for HELO/EHLO - default getHostName()</li>
+ * </ul>
+ * <p/>
+ * There is no way to indicate failure for a given recipient (it's possible to have a
+ * recipient address rejected).  The sun impl throws exceptions even if others successful),
+ * but maybe we do a different way...
+ * <p/>
+ * TODO : lots.  ESMTP, user/pass, indicate failure, etc...
  *
  * @version $Rev$ $Date$
  */
-public class SMTPTransport extends AbstractTransport {
-
+public class SMTPTransport extends Transport {
     /**
-     *  constants for EOL termination
+     * constants for EOL termination
      */
     private static final char CR = 0x0D;
     private static final char LF = 0x0A;
 
     /**
-     *  property key for SMTP server to talk to
+     * property key for SMTP server to talk to
      */
     private static final String MAIL_HOST = "mail.host";
     private static final String MAIL_SMTP_LOCALHOST = "mail.smtp.localhost";
@@ -88,26 +78,14 @@
         super(session, name);
     }
 
-    /* (non-Javadoc)
-     * @see javax.mail.Transport#sendMessage(javax.mail.Message, javax.mail.Address[])
-     */
-    public void sendMessage(Message message, Address[] addresses)
-        throws MessagingException {
-
-        /*
-         * do it and ignore the return
-         */
+    public void sendMessage(Message message, Address[] addresses) throws MessagingException
{
+        // do it and ignore the return
         sendMessage(addresses, message);
     }
 
-    public SendStatus[] sendMessage(Address[] addresses, Message message)
-        throws MessagingException {
-
-        /*
-         * don't bother me w/ null messages or no addreses
-         */
-
-        if (message == null ) {
+    public SendStatus[] sendMessage(Address[] addresses, Message message) throws MessagingException
{
+        // don't bother me w/ null messages or no addreses
+        if (message == null) {
             throw new MessagingException("Null message");
         }
 
@@ -120,90 +98,62 @@
 
         try {
 
-            /*
-             * create socket and connect to server.
-             */
-
+            // create socket and connect to server.
             Socket s = getConnectedSocket();
 
-            /*
-             *  receive welcoming message
-             */
+            // receive welcoming message
             if (!getWelcome(s)) {
                 throw new MessagingException("Error in getting welcome msg");
             }
 
-            /*
-             * say hello
-             */
+            // say hello
             if (!sendHelo(s)) {
                 throw new MessagingException("Error in saying HELO to server");
             }
 
-            /*
-             * send sender
-             */
+
+            // send sender
             if (!sendMailFrom(s, message.getFrom())) {
                 throw new MessagingException("Error in setting the MAIL FROM");
             }
 
-            /*
-             * send recipients.  Only send if not null or "", and just ignore
-             * (but log) any errors
-             */
-
-            for (int i=0; i < addresses.length; i++) {
+            // send recipients.  Only send if not null or "", and just ignore (but log) any
errors
+            for (int i = 0; i < addresses.length; i++) {
                 String to = addresses[i].toString();
 
                 int status = SendStatus.SUCCESS;
 
                 if (to != null && !"".equals(to)) {
                     if (!sendRcptTo(s, to)) {
-
-                        // this means it didn't like our recipient.  I say we keep
-                        // going
-
+                        // this means it didn't like our recipient.  I say we keep going
                         if (this.session.getDebug()) {
                             this.session.getDebugOut().println("ERROR setting recipient "
+ to);
                         }
 
                         status = SendStatus.FAIL;
                     }
-                }
-                else {
+                } else {
                     status = SendStatus.FAIL;
                 }
 
                 stat[i] = new SendStatus(status, to);
             }
 
-            /*
-             * send data
-             */
+            // send data
             if (!sendData(s, message)) {
                 throw new MessagingException("Error sending data");
             }
 
-            /*
-             * say goodbye
-             */
-
+            // say goodbye
             sendQuit(s);
 
             try {
                 s.close();
+            } catch (IOException ignored) {
             }
-            catch (IOException e) {
-                //
-                // TODO - should we just eat this?  We have delivered the msg...
-                //
-                e.printStackTrace();
-            }
-        }
-        catch (SMTPTransportException e) {
+        } catch (SMTPTransportException e) {
             throw new MessagingException("error", e);
-        }
-        catch (MalformedSMTPReplyException e) {
+        } catch (MalformedSMTPReplyException e) {
             throw new MessagingException("error", e);
         }
 
@@ -214,23 +164,13 @@
      * Sends the data in the message down the socket.  This presumes the
      * server is in the right place and ready for getting the DATA message
      * and the data right place in the sequence
-     *
-     * @param s
-     * @param msg
-     * @return
-     * @throws SMTPTransportException
-     * @throws MalformedSMTPReplyException
      */
-    protected boolean sendData(Socket s, Message msg)
-        throws SMTPTransportException, MalformedSMTPReplyException {
-
+    protected boolean sendData(Socket s, Message msg) throws SMTPTransportException, MalformedSMTPReplyException
{
         if (msg == null) {
             throw new SMTPTransportException("invalid message");
         }
 
-        /*
-         * send the DATA command
-         */
+        // send the DATA command
         sendLine(s, "DATA");
 
         SMTPReply line = new SMTPReply(receiveLine(s, 5 * MIN_MILLIS));
@@ -243,10 +183,7 @@
             return false;
         }
 
-        /*
-         * now the data...  I could look at the type, but
-         */
-
+        // now the data...  I could look at the type, but
         try {
             OutputStream os = s.getOutputStream();
 
@@ -255,17 +192,13 @@
 
             msg.writeTo(os);
             os.flush();
-        }
-        catch (IOException e) {
+        } catch (IOException e) {
             throw new SMTPTransportException(e);
-        }
-        catch(MessagingException e) {
+        } catch (MessagingException e) {
             throw new SMTPTransportException(e);
         }
 
-        /*
-         * now to finish
-         */
+        // now to finish
         sendLine(s, "");
         sendLine(s, ".");
 
@@ -275,16 +208,9 @@
     }
 
     /**
-     *  Sends the QUIT message and receieves the response
-     *
-     * @param s
-     * @return
-     * @throws SMTPTransportException
-     * @throws MalformedSMTPReplyException
+     * Sends the QUIT message and receieves the response
      */
-    protected boolean sendQuit(Socket s)
-        throws SMTPTransportException, MalformedSMTPReplyException {
-
+    protected boolean sendQuit(Socket s) throws SMTPTransportException, MalformedSMTPReplyException
{
         sendLine(s, "QUIT");
 
         SMTPReply line = new SMTPReply(receiveLine(s, 5 * MIN_MILLIS));
@@ -294,16 +220,8 @@
 
     /**
      * Sets a receiver address for the current message
-     *
-     * @param s
-     * @param addr
-     * @return
-     * @throws SMTPTransportException
-     * @throws MalformedSMTPReplyException
      */
-    protected boolean sendRcptTo(Socket s, String addr)
-        throws SMTPTransportException, MalformedSMTPReplyException {
-
+    protected boolean sendRcptTo(Socket s, String addr) throws SMTPTransportException, MalformedSMTPReplyException
{
         if (addr == null || "".equals(addr)) {
             throw new SMTPTransportException("invalid address");
         }
@@ -319,23 +237,13 @@
 
     /**
      * Set the sender for this mail.
-     * @param s
-     * @param from
-     * @return
-     * @throws SMTPTransportException
-     * @throws MalformedSMTPReplyException
      */
-    protected boolean sendMailFrom(Socket s, Address[] from)
-            throws SMTPTransportException, MalformedSMTPReplyException {
-
+    protected boolean sendMailFrom(Socket s, Address[] from) throws SMTPTransportException,
MalformedSMTPReplyException {
         if (from == null || from.length == 0) {
             throw new SMTPTransportException("no FROM address");
         }
 
-        /*
-         * TODO - what do we do w/ more than one from???
-         */
-
+        // TODO - what do we do w/ more than one from???
         String msg = "MAIL FROM: " + fixEmailAddress(from[0].toString());
 
         sendLine(s, msg);
@@ -346,25 +254,19 @@
     }
 
     /**
-     *  Sends the initiating "HELO" message.  We're keeping it simple, just
+     * Sends the initiating "HELO" message.  We're keeping it simple, just
      * identifying ourselves as we dont' require service extensions, and
-     *  want to keep it simple for now
+     * want to keep it simple for now
      *
      * @param s socket we are talking on.  It's assumed to be open and in
-     *    right state for this message
-     * @return
-     * @throws SMTPTransportException
-     * @throws MalformedSMTPReplyException
+     * right state for this message
      */
-    protected boolean sendHelo(Socket s)
-        throws SMTPTransportException, MalformedSMTPReplyException {
-
+    protected boolean sendHelo(Socket s) throws SMTPTransportException, MalformedSMTPReplyException
{
         String fqdm = null;
 
         try {
             fqdm = InetAddress.getLocalHost().getHostName();
-        }
-        catch (UnknownHostException e) {
+        } catch (UnknownHostException e) {
             // fine, we're misconfigured - ignore
         }
 
@@ -385,32 +287,18 @@
     }
 
     /**
-     *  Get the servers welcome blob from the wire....
-     *
-     * @param s
-     * @return
-     * @throws SMTPTransportException
-     * @throws MalformedSMTPReplyException
+     * Get the servers welcome blob from the wire....
      */
-    protected boolean getWelcome(Socket s)
-        throws SMTPTransportException, MalformedSMTPReplyException {
-
+    protected boolean getWelcome(Socket s) throws SMTPTransportException, MalformedSMTPReplyException
{
         SMTPReply line = new SMTPReply(receiveLine(s, 5 * MIN_MILLIS));
-
         return !line.isError();
     }
 
     /**
-     *  Sends a  message down the socket and terminates with the
-     *  appropriate CRLF
-     *
-     * @param s
-     * @param data
-     * @throws SMTPTransportException
+     * Sends a  message down the socket and terminates with the
+     * appropriate CRLF
      */
-    protected void sendLine(Socket s, String data)
-        throws SMTPTransportException {
-
+    protected void sendLine(Socket s, String data) throws SMTPTransportException {
         if (s == null) {
             throw new SMTPTransportException("bonehead...");
         }
@@ -430,22 +318,19 @@
             if (this.session.getDebug()) {
                 this.session.getDebugOut().println("sent: " + data);
             }
-        }
-        catch (IOException e) {
+        } catch (IOException e) {
             throw new SMTPTransportException(e);
         }
     }
 
     /**
-     *  Receives one line from the server.  A line is a sequence of bytes
-     *  terminated by a CRLF
+     * Receives one line from the server.  A line is a sequence of bytes
+     * terminated by a CRLF
      *
      * @param s socket to receive from
      * @return the line from the server as String
      */
-    protected String receiveLine(Socket s, int delayMillis)
-        throws SMTPTransportException {
-
+    protected String receiveLine(Socket s, int delayMillis) throws SMTPTransportException
{
         if (s == null) {
             throw new SMTPTransportException("bonehead...");
         }
@@ -457,11 +342,7 @@
         int timeout = 0;
 
         try {
-
-            /*
-             * for now, read byte for byte, looking for a CRLF
-             */
-
+            // for now, read byte for byte, looking for a CRLF
             timeout = s.getSoTimeout();
 
             s.setSoTimeout(delayMillis);
@@ -469,11 +350,11 @@
             InputStream is = s.getInputStream();
 
             StringBuffer buff = new StringBuffer();
-            
+
             int c;
             boolean crFound = false, lfFound = false;
 
-            while((c = is.read()) != -1  && crFound == false && lfFound ==
false) {
+            while ((c = is.read()) != -1 && crFound == false && lfFound ==
false) {
                 buff.append((char) c);
 
                 if (c == CR) {
@@ -489,18 +370,14 @@
             }
 
             return buff.toString();
-        }
-        catch (SocketException e) {
+        } catch (SocketException e) {
             throw new SMTPTransportException(e);
-        }
-        catch (IOException e) {
+        } catch (IOException e) {
             throw new SMTPTransportException(e);
-        }
-        finally {
+        } finally {
             try {
                 s.setSoTimeout(timeout);
-            }
-            catch(SocketException e) {
+            } catch (SocketException e) {
                 // ignore - was just trying to do the decent thing...
             }
         }
@@ -508,14 +385,9 @@
 
 
     /**
-     *  Creates and returns a connected socket
-     *
-     * @return
-     * @throws MessagingException
+     * Creates and returns a connected socket
      */
-    protected Socket getConnectedSocket()
-        throws MessagingException {
-
+    protected Socket getConnectedSocket() throws MessagingException {
         Socket s = new Socket();
 
         String mail_host = this.session.getProperty(MAIL_HOST);
@@ -532,14 +404,12 @@
 
             try {
                 port = Integer.parseInt(portString);
-            }
-            catch (NumberFormatException e) {
+            } catch (NumberFormatException e) {
                 // ignore - we don't care, leave as default
             }
         }
 
         try {
-
             if (this.session.getDebug()) {
                 this.session.getDebugOut().println("connecting to " + mail_host);
             }
@@ -549,9 +419,7 @@
             if (this.session.getDebug()) {
                 this.session.getDebugOut().println("connected to " + mail_host);
             }
-        }
-        catch (IOException e) {
-
+        } catch (IOException e) {
             if (this.session.getDebug()) {
                 this.session.getDebugOut().println("error connecting to " + mail_host);
             }
@@ -562,79 +430,16 @@
         return s;
     }
 
-    private String fixEmailAddress(String mail)
-    {
+    private String fixEmailAddress(String mail) {
         if (mail.charAt(0) == '<') {
             return mail;
         }
         return "<" + mail + ">";
     }
 
-    public static void main(String[] args)
-        throws Exception {
-
-        Properties props = new Properties();
-        props.setProperty("mail.host", "localhost");
-        props.setProperty("mail.transport.protocol", "smtp");
-//      props.setProperty("mail.smtp.class", "org.apache.geronimo.mail.SMTPTransport");
-
-        Session session = Session.getInstance(props);
-
-        session.setDebug(true);
-
-        Transport t = session.getTransport("smtp");
-
-        MimeMessage msg = new MimeMessage(session);
-
-        msg.setFrom(new InternetAddress("chris@email.com"));
-        msg.addRecipients(Message.RecipientType.TO, "rickmcg@gmail.com");
-        msg.setSubject("From SMTPTransport : this is the second subject");
-        msg.setText("This is the second content (via SMTPTransport)");
-        try {
-
-            t.connect();
-            t.sendMessage(msg, new Address[] {new InternetAddress("rick@us.ibm.com")});
-        } catch (Throwable e) {
-            System.out.println("Exception received: " + e);
-            e.printStackTrace();
-        }
-
-/*
-        MimeMultipart mmpt = new MimeMultipart();
-        MimeBodyPart b1 = new MimeBodyPart();
-        b1.setContent("body 1", "text/plain");
-
-        mmpt.addBodyPart(b1);
-
-        b1 = new MimeBodyPart();
-        b1.setContent("body2", "text/plain");
-        mmpt.addBodyPart(b1);
-
-        Address[] list = new Address[1];
-        list[0] =  new InternetAddress("rick@us.ibm.com");
-//        list[1] =  new InternetAddress("jeremy@boynes.com");
-
-        msg.setSubject("From SMTPTransport : this is the subject");
-        msg.setFrom(new InternetAddress("rickmcg@gmail.com"));
-        msg.setContent("This is the content (via SMTPTransport)", "text/plain");
-        msg.setRecipients(Message.RecipientType.TO, list);
-//        msg.setContent(mmpt);
-
-        msg.setSentDate(new Date());
-
-        try {
-            t.sendMessage(msg, list);
-        } catch (Throwable e) {
-            System.out.println("Exception received: " + e);
-            e.printStackTrace();
-        }
-        */
-    }
-
     /**
-     *  Simple holder class for the address/send status duple, as we can
-     *  have mixed success for a set of addresses and a message
-     *
+     * Simple holder class for the address/send status duple, as we can
+     * have mixed success for a set of addresses and a message
      */
     public class SendStatus {
         public final static int SUCCESS = 0;

Copied: geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail/transport/smtp/SMTPTransportException.java
(from r351864, geronimo/trunk/sandbox/mail/src/java/org/apache/geronimo/mail/smtp/SMTPTransportException.java)
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail/transport/smtp/SMTPTransportException.java?p2=geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail/transport/smtp/SMTPTransportException.java&p1=geronimo/trunk/sandbox/mail/src/java/org/apache/geronimo/mail/smtp/SMTPTransportException.java&r1=351864&r2=351866&rev=351866&view=diff
==============================================================================
--- geronimo/trunk/sandbox/mail/src/java/org/apache/geronimo/mail/smtp/SMTPTransportException.java
(original)
+++ geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail/transport/smtp/SMTPTransportException.java
Fri Dec  2 17:12:14 2005
@@ -15,7 +15,7 @@
  *  limitations under the License.
  */
 
-package org.apache.geronimo.mail.smtp;
+package org.apache.geronimo.javamail.transport.smtp;
 
 /**
  *  General purpose Exception

Copied: geronimo/trunk/modules/javamail-transport/src/resources/META-INF/javamail.default.address.map
(from r351823, geronimo/trunk/sandbox/mail/src/resources/META-INF/javamail.default.address.map)
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/javamail-transport/src/resources/META-INF/javamail.default.address.map?p2=geronimo/trunk/modules/javamail-transport/src/resources/META-INF/javamail.default.address.map&p1=geronimo/trunk/sandbox/mail/src/resources/META-INF/javamail.default.address.map&r1=351823&r2=351866&rev=351866&view=diff
==============================================================================
--- geronimo/trunk/sandbox/mail/src/resources/META-INF/javamail.default.address.map (original)
+++ geronimo/trunk/modules/javamail-transport/src/resources/META-INF/javamail.default.address.map
Fri Dec  2 17:12:14 2005
@@ -4,7 +4,6 @@
 #
 # Note that you can't override these defaults, merely add to them.
 #
-# 1.3 2003/08/28 12:52:52
+# $Rev$ $Date$
 #
 rfc822=smtp
-news=nntp

Copied: geronimo/trunk/modules/javamail-transport/src/resources/META-INF/javamail.default.providers
(from r351823, geronimo/trunk/sandbox/mail/src/resources/META-INF/javamail.default.providers)
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/javamail-transport/src/resources/META-INF/javamail.default.providers?p2=geronimo/trunk/modules/javamail-transport/src/resources/META-INF/javamail.default.providers&p1=geronimo/trunk/sandbox/mail/src/resources/META-INF/javamail.default.providers&r1=351823&r2=351866&rev=351866&view=diff
==============================================================================
--- geronimo/trunk/sandbox/mail/src/resources/META-INF/javamail.default.providers (original)
+++ geronimo/trunk/modules/javamail-transport/src/resources/META-INF/javamail.default.providers
Fri Dec  2 17:12:14 2005
@@ -4,10 +4,6 @@
 #
 # Note that you can't override these defaults, merely add to them.
 #
-# 1.3 2003/08/28 12:52:52
+# $Rev$ $Date$
 #
-protocol=imap; type=store; class=org.apache.geronimo.mail.imap.IMAPStore; vendor=Apache Software
Foundation; version=1.0
-protocol=pop3; type=store; class=org.apache.geronimo.mail.pop3.POP3Store; vendor=Apache Software
Foundation; version=1.0
-protocol=pop; type=store; class=org.apache.geronimo.mail.pop3.POP3Store; vendor=Apache Software
Foundation; version=1.0
 protocol=smtp; type=transport; class=org.apache.geronimo.mail.smtp.SMTPTransport; vendor=Apache
Software Foundation; version=1.0
-protocol=nntp; type=transport; class=org.apache.geronimo.mail.nntp.NNTPTransport; vendor=Apache
Software Foundation; version=1.0



Mime
View raw message