';
// Separator
diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php
index 32d795db528..e19892e9a58 100644
--- a/htdocs/core/class/CMailFile.class.php
+++ b/htdocs/core/class/CMailFile.class.php
@@ -495,7 +495,7 @@ class CMailFile
$res=false;
- if (empty($conf->global->MAIN_DISABLE_ALL_MAILS))
+ if (empty($conf->global->MAIN_DISABLE_ALL_MAILS) || !empty($conf->global->MAIN_MAIL_FORCE_SENDTO))
{
require_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
$hookmanager = new HookManager($db);
@@ -563,6 +563,12 @@ class CMailFile
$keyfortls ='MAIN_MAIL_EMAIL_TLS_EMAILING';
$keyforstarttls ='MAIN_MAIL_EMAIL_STARTTLS_EMAILING';
}
+
+ if(!empty($conf->global->MAIN_MAIL_FORCE_SENDTO)) {
+ $this->addr_to = $conf->global->MAIN_MAIL_FORCE_SENDTO;
+ $this->addr_cc = '';
+ $this->addr_bcc = '';
+ }
// Action according to choosed sending method
if ($this->sendmode == 'mail')
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index c7b835806c8..71acd0e71cb 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -272,6 +272,7 @@ MAIN_MAIL_EMAIL_FROM=Sender email for automatic emails (By default in php.ini: <
MAIN_MAIL_ERRORS_TO=Sender email used for error returns emails sent
MAIN_MAIL_AUTOCOPY_TO= Send systematically a hidden carbon-copy of all sent emails to
MAIN_DISABLE_ALL_MAILS=Disable all emails sendings (for test purposes or demos)
+MAIN_MAIL_FORCE_SENDTO=Send all emails to (instead of real recipients, for test purposes)
MAIN_MAIL_SENDMODE=Method to use to send EMails
MAIN_MAIL_SMTPS_ID=SMTP ID if authentication required
MAIN_MAIL_SMTPS_PW=SMTP Password if authentication required