diff --git a/ChangeLog b/ChangeLog
index 6691ddb2007..06f01bc0e11 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -12,6 +12,7 @@ For users:
MARGIN_PMP_AS_DEFAULT_BUY_PRICE to replace with first supplier price.
- Introduce option MAIN_HTML_TITLE to start to control format of html title content.
- Add extrafields on bank account cards.
+- Added delay between mails in Newsletter module
For translators:
- Update language files.
diff --git a/htdocs/admin/mailing.php b/htdocs/admin/mailing.php
index 22a6531fad6..8c080999e6c 100644
--- a/htdocs/admin/mailing.php
+++ b/htdocs/admin/mailing.php
@@ -48,11 +48,14 @@ if ($action == 'setvalue')
$mailerror = GETPOST('MAILING_EMAIL_ERRORSTO','alpha');
$checkread = GETPOST('value','alpha');
$checkread_key = GETPOST('MAILING_EMAIL_UNSUBSCRIBE_KEY','alpha');
+ $mailingdelay = GETPOST('MAILING_DELAY', 'int');
$res=dolibarr_set_const($db, "MAILING_EMAIL_FROM",$mailfrom,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
$res=dolibarr_set_const($db, "MAILING_EMAIL_ERRORSTO",$mailerror,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
+ $res=dolibarr_set_const($db, "MAILING_DELAY",$mailingdelay,'chaine',0,'',$conf->entity);
+ if (! $res > 0) $error++;
// Create temporary encryption key if nedded
$res=dolibarr_set_const($db, "MAILING_EMAIL_UNSUBSCRIBE_KEY",$checkread_key,'chaine',0,'',$conf->entity);
@@ -124,6 +127,12 @@ print '';
+$var=!$var;
+print '
| ';
+print $langs->trans("MailingDelay").' | ';
+print '';
+print ' |
';
+
// Constant to add salt into the unsubscribe and check read tag.
// It is also used as a security key parameter.
$var=!$var;
diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php
index ca4c27bfdbc..821fadb94c9 100644
--- a/htdocs/comm/mailing/card.php
+++ b/htdocs/comm/mailing/card.php
@@ -323,7 +323,10 @@ if ($action == 'sendallconfirmed' && $confirm == 'yes')
}
}
-
+ if (!empty($conf->global->MAILING_DELAY)) {
+ sleep($conf->global->MAILING_DELAY);
+ }
+
//test if CHECK READ change statut prospect contact
}
else
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index 0b328e705a7..03180d37b69 100755
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -1393,6 +1393,7 @@ RSSUrlExample=An interesting RSS feed
MailingSetup=EMailing module setup
MailingEMailFrom=Sender EMail (From) for emails sent by emailing module
MailingEMailError=Return EMail (Errors-to) for emails with errors
+MailingDelay=Seconds to wait after sending next message
##### Notification #####
NotificationSetup=EMail notification module setup
NotificationEMailFrom=Sender EMail (From) for emails sent for notifications
diff --git a/scripts/emailings/mailing-send.php b/scripts/emailings/mailing-send.php
index 1de66b491ed..e7b32b2d3bc 100755
--- a/scripts/emailings/mailing-send.php
+++ b/scripts/emailings/mailing-send.php
@@ -245,6 +245,11 @@ if ($resql)
$error++;
}
}
+
+ if (!empty($conf->global->MAILING_DELAY)) {
+ sleep($conf->global->MAILING_DELAY);
+ }
+
}
}
else