diff --git a/htdocs/comm/mailing/fiche.php b/htdocs/comm/mailing/fiche.php
index ae5e85eca46..3ec1528c4a3 100644
--- a/htdocs/comm/mailing/fiche.php
+++ b/htdocs/comm/mailing/fiche.php
@@ -690,9 +690,13 @@ else
}
else
{
- $text=$langs->trans("MailingNeedCommand");
- $text.='
';
- $text.='
';
+ $text='';
+ if (empty($conf->file->mailing_limit_sendbyweb))
+ {
+ $text.=$langs->trans("MailingNeedCommand");
+ $text.='
';
+ $text.='
';
+ }
$text.=$langs->trans('ConfirmSendingEmailing').'
';
$text.=$langs->trans('LimitSendingEmailing',$conf->global->MAILING_LIMIT_SENDBYWEB);
$ret=$html->form_confirm($_SERVER['PHP_SELF'].'?id='.$_REQUEST['id'],$langs->trans('SendMailing'),$text,'sendallconfirmed',$formquestion,'',1,260);
diff --git a/htdocs/conf/conf.php.example b/htdocs/conf/conf.php.example
index bdf2ca4fdf5..ed76ec41c90 100644
--- a/htdocs/conf/conf.php.example
+++ b/htdocs/conf/conf.php.example
@@ -237,6 +237,12 @@ $dolibarr_main_prod='0';
# Examples:
# $dolibarr_main_limit_users='0';
+# dolibarr_mailing_limit_sendbyweb
+# Can set a limit for mailing send by web, can be used for a restricted mode.
+# Default value: 0 (use database value if exist)
+# Examples:
+# $dolibarr_mailing_limit_sendbyweb='0';
+
# This is an development feature to allow external components to overwrite
# some Dolibarr kernel files to be overwritten by versions provided by
# third parties modules.
diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php
index 66a205927e2..405e60515e9 100644
--- a/htdocs/master.inc.php
+++ b/htdocs/master.inc.php
@@ -176,6 +176,8 @@ if (empty($dolibarr_main_db_cryptkey)) $dolibarr_main_db_cryptkey='';
$conf->db->dolibarr_main_db_cryptkey = $dolibarr_main_db_cryptkey;
if (empty($dolibarr_main_limit_users)) $dolibarr_main_limit_users=0;
$conf->file->main_limit_users = $dolibarr_main_limit_users;
+if (empty($dolibarr_mailing_limit_sendbyweb)) $dolibarr_mailing_limit_sendbyweb=0;
+$conf->file->mailing_limit_sendbyweb = $dolibarr_mailing_limit_sendbyweb;
if (defined('TEST_DB_FORCE_TYPE')) $conf->db->type=constant('TEST_DB_FORCE_TYPE'); // For test purpose
// Identifiant autres
$conf->file->main_authentication = empty($dolibarr_main_authentication)?'':$dolibarr_main_authentication;
@@ -312,6 +314,12 @@ if (! defined('NOREQUIREDB'))
$conf->setValues($db);
}
+// Overwrite database value
+if (! empty($conf->file->mailing_limit_sendbyweb))
+{
+ $conf->global->MAILING_LIMIT_SENDBYWEB = $conf->file->mailing_limit_sendbyweb;
+}
+
// If software has been locked. Only login $conf->global->MAIN_ONLY_LOGIN_ALLOWED is allowed.
if (! empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED))
{