diff --git a/migration/360lts-release/oracle/746_FR3090719.sql b/migration/360lts-release/oracle/746_FR3090719.sql new file mode 100644 index 0000000000..4c2e902362 --- /dev/null +++ b/migration/360lts-release/oracle/746_FR3090719.sql @@ -0,0 +1,15 @@ +-- Nov 10, 2010 10:55:25 AM COT +-- FR3090719-Send BCC to From sending e-mail +INSERT INTO AD_SysConfig (AD_Client_ID,AD_Org_ID,AD_SysConfig_ID,ConfigurationLevel,Created,CreatedBy,Description,EntityType,IsActive,Name,Updated,UpdatedBy,Value) VALUES (0,0,50049,'C',TO_DATE('2010-11-10 10:55:24','YYYY-MM-DD HH24:MI:SS'),100,'When enabled the outgoing mails from Adempiere will be sent BCC to the originating user','D','Y','MAIL_SEND_BCC_TO_FROM',TO_DATE('2010-11-10 10:55:24','YYYY-MM-DD HH24:MI:SS'),100,'N') +; + +-- Nov 10, 2010 11:06:53 AM COT +-- FR3090719-Send BCC to From sending e-mail +INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,53117,0,TO_DATE('2010-11-10 11:06:52','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Cc','E',TO_DATE('2010-11-10 11:06:52','YYYY-MM-DD HH24:MI:SS'),100,'Cc') +; + +-- Nov 10, 2010 11:06:53 AM COT +-- FR3090719-Send BCC to From sending e-mail +INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=53117 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID) +; + diff --git a/migration/360lts-release/postgresql/746_FR3090719.sql b/migration/360lts-release/postgresql/746_FR3090719.sql new file mode 100644 index 0000000000..be01b6c474 --- /dev/null +++ b/migration/360lts-release/postgresql/746_FR3090719.sql @@ -0,0 +1,15 @@ +-- Nov 10, 2010 10:55:25 AM COT +-- FR3090719-Send BCC to From sending e-mail +INSERT INTO AD_SysConfig (AD_Client_ID,AD_Org_ID,AD_SysConfig_ID,ConfigurationLevel,Created,CreatedBy,Description,EntityType,IsActive,Name,Updated,UpdatedBy,Value) VALUES (0,0,50049,'C',TO_TIMESTAMP('2010-11-10 10:55:24','YYYY-MM-DD HH24:MI:SS'),100,'When enabled the outgoing mails from Adempiere will be sent BCC to the originating user','D','Y','MAIL_SEND_BCC_TO_FROM',TO_TIMESTAMP('2010-11-10 10:55:24','YYYY-MM-DD HH24:MI:SS'),100,'N') +; + +-- Nov 10, 2010 11:06:53 AM COT +-- FR3090719-Send BCC to From sending e-mail +INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,53117,0,TO_TIMESTAMP('2010-11-10 11:06:52','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Cc','E',TO_TIMESTAMP('2010-11-10 11:06:52','YYYY-MM-DD HH24:MI:SS'),100,'Cc') +; + +-- Nov 10, 2010 11:06:53 AM COT +-- FR3090719-Send BCC to From sending e-mail +INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=53117 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID) +; + diff --git a/org.adempiere.base/src/org/compiere/util/EMail.java b/org.adempiere.base/src/org/compiere/util/EMail.java index ab10af53b4..1250df8183 100644 --- a/org.adempiere.base/src/org/compiere/util/EMail.java +++ b/org.adempiere.base/src/org/compiere/util/EMail.java @@ -45,6 +45,7 @@ import javax.mail.internet.MimeMessage; import javax.mail.internet.MimeMultipart; import org.compiere.model.MClient; +import org.compiere.model.MSysConfig; import com.sun.mail.smtp.SMTPMessage; @@ -68,9 +69,9 @@ import com.sun.mail.smtp.SMTPMessage; public final class EMail implements Serializable { /** - * + * */ - private static final long serialVersionUID = -2526338392563042117L; + private static final long serialVersionUID = -1408649015285763245L; //use in server bean public final static String HTML_MAIL_MARKER = "ContentType=text/html;"; /** @@ -132,6 +133,9 @@ public final class EMail implements Serializable { setSmtpHost(smtpHost); setFrom(from); + String bccAddressForAllMails = MSysConfig.getValue("MAIL_SEND_BCC_TO_ADDRESS", Env.getAD_Client_ID(Env.getCtx())); + if (bccAddressForAllMails != null && bccAddressForAllMails.length() > 0) + addBcc(bccAddressForAllMails); addTo(to); m_ctx = ctx; if (subject == null || subject.length() == 0) @@ -494,6 +498,8 @@ public final class EMail implements Serializable try { m_from = new InternetAddress (newFrom, true); + if (MSysConfig.getBooleanValue("MAIL_SEND_BCC_TO_FROM", false, Env.getAD_Client_ID(Env.getCtx()))); + addBcc(newFrom); } catch (Exception e) {