FR 3090719 - Send BCC to From sending e-mail

Thanks to Marcelo Luiz Onhate (monhate) - OSEB project
Link to SF Tracker: http://sourceforge.net/support/tracker.php?aid=3090719

Extending idea as suggested by Steven Sackett - Adaxa
Send BCC to a client-wide defined address
Fixing according to suggestion from Marcelo Luiz Onhate (monhate)
This commit is contained in:
Carlos Ruiz 2011-03-08 11:36:40 -05:00
parent 5502bff9bd
commit 2b150d7c16
3 changed files with 38 additions and 2 deletions

View File

@ -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)
;

View File

@ -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)
;

View File

@ -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)
{