From 1ec73fb1feb4768469302638ad06f56a555d478a Mon Sep 17 00:00:00 2001 From: Thomas Bayen Date: Thu, 4 Sep 2014 08:57:54 +0200 Subject: [PATCH] IDEMPIERE-2182 - Allow many mail addresses with MAIL_SEND_BCC_TO_ADDRESS --- .../src/org/compiere/util/EMail.java | 29 ++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/util/EMail.java b/org.adempiere.base/src/org/compiere/util/EMail.java index 05affd37ec..70f25d0844 100644 --- a/org.adempiere.base/src/org/compiere/util/EMail.java +++ b/org.adempiere.base/src/org/compiere/util/EMail.java @@ -314,7 +314,7 @@ public final class EMail implements Serializable } else { String bccAddressForAllMails = MSysConfig.getValue(MSysConfig.MAIL_SEND_BCC_TO_ADDRESS, Env.getAD_Client_ID(Env.getCtx())); if (! Util.isEmpty(bccAddressForAllMails, true)) { - m_msg.setRecipient (Message.RecipientType.TO, new InternetAddress(bccAddressForAllMails, true)); + m_msg.setRecipients (Message.RecipientType.TO, bccAddressForAllMails); } List replyToList=new ArrayList(); if(m_replyTo!=null) @@ -697,19 +697,22 @@ public final class EMail implements Serializable { if (newBcc == null || newBcc.length() == 0) return false; - InternetAddress ia = null; - try - { - ia = new InternetAddress (newBcc, true); + String[] addresses = newBcc.split(", *"); + for (String bccAddress : addresses) { + InternetAddress ia = null; + try + { + ia = new InternetAddress (bccAddress, true); + } + catch (Exception e) + { + log.log(Level.WARNING, bccAddress + ": " + e.getMessage()); + return false; + } + if (m_bcc == null) + m_bcc = new ArrayList(); + m_bcc.add (ia); } - catch (Exception e) - { - log.log(Level.WARNING, newBcc + ": " + e.getMessage()); - return false; - } - if (m_bcc == null) - m_bcc = new ArrayList(); - m_bcc.add (ia); return true; } // addBcc