[Schmitzm-commits] r1621 - trunk/schmitzm-core/src/main/java/de/schmitzm/net/mail

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Jul 8 16:31:50 CEST 2011


Author: mojays
Date: 2011-07-08 16:31:49 +0200 (Fri, 08 Jul 2011)
New Revision: 1621

Modified:
   trunk/schmitzm-core/src/main/java/de/schmitzm/net/mail/MailUtil.java
Log:
MailUtil.sendDesktopMail(..) mit CC und BCC

Modified: trunk/schmitzm-core/src/main/java/de/schmitzm/net/mail/MailUtil.java
===================================================================
--- trunk/schmitzm-core/src/main/java/de/schmitzm/net/mail/MailUtil.java	2011-07-07 20:22:05 UTC (rev 1620)
+++ trunk/schmitzm-core/src/main/java/de/schmitzm/net/mail/MailUtil.java	2011-07-08 14:31:49 UTC (rev 1621)
@@ -122,17 +122,36 @@
 		Transport.send(msg);
 	}
 
-	/**
+    /**
+     * Opens the local mail client with a new mail.
+     * 
+     * @param mailDestAddr
+     *            destination address(es); can be {@code null}
+     * @param mailSubject
+     *            mail subject; can be {@code null}
+     * @param mailBody
+     *            mail body content; can be {@code null}
+     */
+    public static void sendDesktopMail(String mailDestAddr, String mailSubject,
+            String mailBody) {
+      sendDesktopMail(mailDestAddr,null,null,mailSubject,mailBody);
+    }
+
+    /**
 	 * Opens the local mail client with a new mail.
 	 * 
 	 * @param mailDestAddr
 	 *            destination address(es); can be {@code null}
+	 * @param mailCcAddr
+	 *            destination address(es) taken as CC; can be {@code null}
+     * @param mailBccAddr
+     *            destination address(es) taken as BCC; can be {@code null}
 	 * @param mailSubject
 	 *            mail subject; can be {@code null}
 	 * @param mailBody
 	 *            mail body content; can be {@code null}
 	 */
-	public static void sendDesktopMail(String mailDestAddr, String mailSubject,
+	public static void sendDesktopMail(String mailDestAddr, String mailCcAddr, String mailBccAddr, String mailSubject,
 			String mailBody) {
 	  
 		if (!Desktop.isDesktopSupported()
@@ -160,6 +179,10 @@
 			uriMailStr.append(mailDestAddr != null ? mailDestAddr : "");
 			uriMailStr.append("?SUBJECT=").append(
 					mailSubject != null ? mailSubject : "");
+			if ( mailCcAddr != null && !mailCcAddr.trim().isEmpty() )
+              uriMailStr.append("&CC=").append(mailCcAddr);
+            if ( mailBccAddr != null && !mailBccAddr.trim().isEmpty() )
+              uriMailStr.append("&BCC=").append(mailBccAddr);
 			uriMailStr.append("&BODY=")
 					.append(mailBody != null ? mailBody : "");
 			URI uriMailTo = new URI("mailto", uriMailStr.toString(), null);



More information about the Schmitzm-commits mailing list