Update of /var/cvs/applications/email/src/org/mmbase/applications/email
In directory james.mmbase.org:/tmp/cvs-serv12809

Modified Files:
        SendMail.java 
Log Message:
logging, and some other details


See also: 
http://cvs.mmbase.org/viewcvs/applications/email/src/org/mmbase/applications/email


Index: SendMail.java
===================================================================
RCS file: 
/var/cvs/applications/email/src/org/mmbase/applications/email/SendMail.java,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -b -r1.45 -r1.46
--- SendMail.java       1 Aug 2008 11:23:09 -0000       1.45
+++ SendMail.java       1 Aug 2008 12:32:49 -0000       1.46
@@ -31,7 +31,7 @@
  * @author Daniel Ockeloen
  * @author Johannes Verelst <[EMAIL PROTECTED]>
  * @since  MMBase-1.6
- * @version $Id: SendMail.java,v 1.45 2008/08/01 11:23:09 michiel Exp $
+ * @version $Id: SendMail.java,v 1.46 2008/08/01 12:32:49 michiel Exp $
  */
 public class SendMail extends AbstractSendMail {
     private static final Logger log = 
Logging.getLoggerInstance(SendMail.class);
@@ -466,7 +466,7 @@
         String body    = n.getStringValue("body");
         String subject = n.getStringValue("subject");
         String mimeType = n.getNodeManager().hasField("mimetype") ? 
n.getStringValue("mimetype") : null;
-        if (mimeType == null) mimeType = "text/html";
+        if (mimeType == null || "".equals(mimeType)) mimeType = "text/html";
 
         try {
 
@@ -701,6 +701,7 @@
         List<InternetAddress> remoteRecipients = new 
ArrayList<InternetAddress>();
         List<InternetAddress>  localRecipients = new 
ArrayList<InternetAddress>();
         if (onlyto != null) {
+            log.debug("Sending to " + onlyto);
             try {
                 InternetAddress[] recipients = InternetAddress.parse(onlyto);
                 for (InternetAddress recipient : recipients) {
@@ -716,8 +717,10 @@
         } else {
             String to = n.getStringValue("to");
             try {
+                log.debug("" + to);
                 InternetAddress[] recipients = InternetAddress.parse(to);
                 for (InternetAddress recipient : recipients) {
+                    log.debug(recipient);
                     if (isLocal(recipient)) {
                         localRecipients.add(recipient);
                     } else {
@@ -763,19 +766,14 @@
         }
 
         if (localRecipients.size() > 0) {
-            InternetAddress[] ia = new InternetAddress[localRecipients.size()];
-            for (int i=0; i<localRecipients.size(); i++) {
-                ia[i] = localRecipients.get(i);
-            }
-            sendLocalMail(ia, n);
+            sendLocalMail(localRecipients.toArray(new InternetAddress[]{}), n);
         }
 
         if (remoteRecipients.size() > 0) {
-            InternetAddress[] ia = new 
InternetAddress[remoteRecipients.size()];
-            for (int i=0; i<remoteRecipients.size(); i++) {
-                ia[i] = remoteRecipients.get(i);
+            sendRemoteMail(remoteRecipients.toArray(new InternetAddress[]{}), 
n);
             }
-            sendRemoteMail(ia, n);
+        if (localRecipients.size() == 0 && remoteRecipients.size() == 0) {
+            log.service("Not mailing " + n + " because no recipients");
         }
 
         return true;
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to