IDEMPIERE-5760: Manage mail.smtp.timeout using SysConfig (#1982)

https://idempiere.atlassian.net/browse/IDEMPIERE-5760

https://github.com/idempiere/idempiere/pull/1883 + changes requested by Carlos (migration script)
This commit is contained in:
Nicolas Micoud 2023-09-02 16:38:13 +02:00 committed by GitHub
parent eee6f449c3
commit 562283fe48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 4 deletions

View File

@ -0,0 +1,10 @@
-- IDEMPIERE-5760
SELECT register_migration_script('202308280920_IDEMPIERE-5760.sql') FROM dual;
SET SQLBLANKLINES ON
SET DEFINE OFF
-- Aug 28, 2023, 9:20:09 AM CEST
INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200233,0,0,TO_TIMESTAMP('2023-08-28 09:20:09','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2023-08-28 09:20:09','YYYY-MM-DD HH24:MI:SS'),10,10,'Y','MAIL_SMTP_TIMEOUT','20000','Timeout in milliseconds to send an email','D','C','66c84808-15eb-4f26-ad23-25d9ea0d96fc')
;

View File

@ -0,0 +1,7 @@
-- IDEMPIERE-5760
SELECT register_migration_script('202308280920_IDEMPIERE-5760.sql') FROM dual;
-- Aug 28, 2023, 9:20:09 AM CEST
INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200233,0,0,TO_TIMESTAMP('2023-08-28 09:20:09','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2023-08-28 09:20:09','YYYY-MM-DD HH24:MI:SS'),10,10,'Y','MAIL_SMTP_TIMEOUT','20000','Timeout in milliseconds to send an email','D','C','66c84808-15eb-4f26-ad23-25d9ea0d96fc')
;

View File

@ -44,7 +44,7 @@ public class MSysConfig extends X_AD_SysConfig
/**
*
*/
private static final long serialVersionUID = 4924291305767860669L;
private static final long serialVersionUID = -2055659961699848343L;
public static final String AD_CHANGELOG_SAVE_UUID = "AD_CHANGELOG_SAVE_UUID";
public static final String ADDRESS_VALIDATION = "ADDRESS_VALIDATION";
@ -137,6 +137,7 @@ public class MSysConfig extends X_AD_SysConfig
public static final String MAIL_SEND_BCC_TO_ADDRESS = "MAIL_SEND_BCC_TO_ADDRESS";
public static final String MAIL_SEND_BCC_TO_FROM = "MAIL_SEND_BCC_TO_FROM";
public static final String MAIL_SEND_CREDENTIALS = "MAIL_SEND_CREDENTIALS";
public static final String MAIL_SMTP_TIMEOUT = "MAIL_SMTP_TIMEOUT";
public static final String MAX_ACTIVITIES_IN_LIST = "MAX_ACTIVITIES_IN_LIST";
public static final String MAX_RESULTS_PER_SEARCH_IN_DOCUMENT_CONTROLLER = "MAX_RESULTS_PER_SEARCH_IN_DOCUMENT_CONTROLLER";
public static final String MAX_ROWS_IN_TABLE_COMBOLIST = "MAX_ROWS_IN_TABLE_COMBOLIST";

View File

@ -74,7 +74,7 @@ public final class EMail implements Serializable
/**
*
*/
private static final long serialVersionUID = 5355436165040508855L;
private static final long serialVersionUID = -8982983766981221312L;
//use in server bean
public final static String HTML_MAIL_MARKER = "ContentType=text/html;";
@ -305,8 +305,8 @@ public final class EMail implements Serializable
props.put("mail.store.protocol", "smtp");
props.put("mail.transport.protocol", "smtp");
props.put("mail.host", m_smtpHost);
//Timeout for sending the email defaulted to 20 seconds
props.put("mail.smtp.timeout", 20000);
//Timeout for sending the email defaulted to 20 seconds if not defined in a SysConfig Key
props.put("mail.smtp.timeout", MSysConfig.getIntValue(MSysConfig.MAIL_SMTP_TIMEOUT, 20000, Env.getAD_Client_ID(m_ctx)));
if (CLogMgt.isLevelFinest())
props.put("mail.debug", "true");