Added delay between mails in Newsletter module

This commit is contained in:
Marcos García de La Fuente 2015-01-18 16:26:26 +01:00
parent 3db231cea6
commit fb186d6ef8
5 changed files with 20 additions and 1 deletions

View File

@ -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.

View File

@ -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 '<input size="32" type="text" name="MAILING_EMAIL_ERRORSTO" value="'.$conf
if (!empty($conf->global->MAILING_EMAIL_ERRORSTO) && ! isValidEmail($conf->global->MAILING_EMAIL_ERRORSTO)) print ' '.img_warning($langs->trans("BadEMail"));
print '</td></tr>';
$var=!$var;
print '<tr '.$bc[$var].'><td>';
print $langs->trans("MailingDelay").'</td><td>';
print '<input size="32" type="text" name="MAILING_DELAY" value="'.$conf->global->MAILING_DELAY.'">';
print '</td></tr>';
// Constant to add salt into the unsubscribe and check read tag.
// It is also used as a security key parameter.
$var=!$var;

View File

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

View File

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

View File

@ -245,6 +245,11 @@ if ($resql)
$error++;
}
}
if (!empty($conf->global->MAILING_DELAY)) {
sleep($conf->global->MAILING_DELAY);
}
}
}
else