New: Add option to send all emails to a bulk carbon copy email.

This commit is contained in:
Laurent Destailleur 2010-08-28 10:55:11 +00:00
parent 4a79ba8a46
commit f5b603af5b
7 changed files with 48 additions and 6 deletions

View File

@ -18,6 +18,7 @@ For users:
- New: Add more volume units (ounce, gallon, inch, feet, ...)
- New: Delivery date accepts hours and minutes.
- New: Can add a comment on stock dispatching to be save into stock movements.
- New: Add option to send all emails sent to a bulk carbon copy.
- Perf: Avoid reading database to determine country code after each
page call.
- Fix: Better Postgresql compatibility.

View File

@ -19,7 +19,7 @@
/**
* \file htdocs/admin/mails.php
* \brief Page de configuration des emails
* \brief Page to setup emails sending
* \version $Id$
*/
@ -31,6 +31,7 @@ $langs->load("products");
$langs->load("admin");
$langs->load("mails");
$langs->load("other");
$langs->load("errors");
if (!$user->admin)
accessforbidden();
@ -57,6 +58,7 @@ if (isset($_POST["action"]) && $_POST["action"] == 'update')
if (isset($_POST["MAIN_MAIL_SMTPS_PW"])) dolibarr_set_const($db, "MAIN_MAIL_SMTPS_PW", $_POST["MAIN_MAIL_SMTPS_PW"],'chaine',0,'',0);
if (isset($_POST["MAIN_MAIL_EMAIL_TLS"])) dolibarr_set_const($db, "MAIN_MAIL_EMAIL_TLS", $_POST["MAIN_MAIL_EMAIL_TLS"],'chaine',0,'',0);
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_FROM", $_POST["MAIN_MAIL_EMAIL_FROM"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_AUTOCOPY_TO", $_POST["MAIN_MAIL_AUTOCOPY_TO"],'chaine',0,'',$conf->entity);
Header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
exit;
@ -280,6 +282,10 @@ if (isset($_GET["action"]) && $_GET["action"] == 'edit')
print $html->selectyesno('MAIN_DISABLE_ALL_MAILS',$conf->global->MAIN_DISABLE_ALL_MAILS,1);
print '</td></tr>';
// Separator
$var=!$var;
print '<tr '.$bc[$var].'><td colspan="2">&nbsp;</td></tr>';
// Method
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_SENDMODE").'</td><td>';
@ -409,10 +415,21 @@ if (isset($_GET["action"]) && $_GET["action"] == 'edit')
else print yn(0).' ('.$langs->trans("NotSupported").')';
print '</td></tr>';
// Separator
$var=!$var;
print '<tr '.$bc[$var].'><td colspan="2">&nbsp;</td></tr>';
// From
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_EMAIL_FROM",ini_get('sendmail_from')?ini_get('sendmail_from'):$langs->transnoentities("Undefined")).'</td><td><input class="flat" name="MAIN_MAIL_EMAIL_FROM" size="32" value="' . $conf->global->MAIN_MAIL_EMAIL_FROM . '"></td></tr>';
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_EMAIL_FROM",ini_get('sendmail_from')?ini_get('sendmail_from'):$langs->transnoentities("Undefined")).'</td>';
print '<td><input class="flat" name="MAIN_MAIL_EMAIL_FROM" size="32" value="' . $conf->global->MAIN_MAIL_EMAIL_FROM;
print '"></td></tr>';
// Autocopy to
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_AUTOCOPY_TO").'</td>';
print '<td><input class="flat" name="MAIN_MAIL_AUTOCOPY_TO" size="32" value="' . $conf->global->MAIN_MAIL_AUTOCOPY_TO;
print '"></td></tr>';
print '</table>';
print '<br><center>';
@ -433,6 +450,10 @@ else
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_DISABLE_ALL_MAILS").'</td><td>'.yn($conf->global->MAIN_DISABLE_ALL_MAILS).'</td></tr>';
// Separator
$var=!$var;
print '<tr '.$bc[$var].'><td colspan="2">&nbsp;</td></tr>';
// Method
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_SENDMODE").'</td><td>';
@ -491,9 +512,23 @@ else
else print yn(0).' ('.$langs->trans("NotSupported").')';
print '</td></tr>';
// Separator
$var=!$var;
print '<tr '.$bc[$var].'><td colspan="2">&nbsp;</td></tr>';
// From
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_EMAIL_FROM",ini_get('sendmail_from')?ini_get('sendmail_from'):$langs->transnoentities("Undefined")).'</td><td>'.$conf->global->MAIN_MAIL_EMAIL_FROM.'</td></tr>';
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_EMAIL_FROM",ini_get('sendmail_from')?ini_get('sendmail_from'):$langs->transnoentities("Undefined")).'</td>';
print '<td>'.$conf->global->MAIN_MAIL_EMAIL_FROM;
if (!empty($conf->global->MAIN_MAIL_EMAIL_FROM) && ! isValidEmail($conf->global->MAIN_MAIL_EMAIL_FROM)) print img_warning($langs->trans("ErrorBadEMail"));
print '</td></tr>';
// Autocopy to
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_AUTOCOPY_TO").'</td>';
print '<td>'.$conf->global->MAIN_MAIL_AUTOCOPY_TO;
if (!empty($conf->global->MAIN_MAIL_AUTOCOPY_TO) && ! isValidEmail($conf->global->MAIN_MAIL_AUTOCOPY_TO)) print img_warning($langs->trans("ErrorBadEMail"));
print '</td></tr>';
print '</table>';

View File

@ -387,6 +387,7 @@ class FormMail
print $form->selectarray("receiverccc", $liste, isset($_REQUEST["receiverccc"])?$_REQUEST["receiverccc"]:0);
}
}
//if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_TO)) print ' '.info_admin("+ ".$conf->global->MAIN_MAIL_AUTOCOPY_TO,1);
print "</td></tr>\n";
}

View File

@ -213,6 +213,7 @@ MAIN_MAIL_SMTP_SERVER=SMTP/SMTPS Host (By default in php.ini: <b>%s</b>)
MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike=SMTP/SMTPS Port (Not defined into PHP on Unix like systems)
MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike=SMTP/SMTPS Host (Not defined into PHP on Unix like systems)
MAIN_MAIL_EMAIL_FROM=Sender e-mail for automatic emails (By default in php.ini: <b>%s</b>)
MAIN_MAIL_AUTOCOPY_TO= Send systematically a hidden carbon-copy of all sent emails to
MAIN_DISABLE_ALL_MAILS=Disable all e-mails sendings (for test purposes or demos)
MAIN_MAIL_SENDMODE=Method to use to send EMails
MAIN_MAIL_SMTPS_ID=SMTP ID if authentication required

View File

@ -213,6 +213,7 @@ MAIN_MAIL_SMTP_SERVER= Nom host ou ip du serveur SMTP/SMTPS (Par défaut dans ph
MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike= Port du serveur SMTP/SMTPS (Non défini dans le PHP sur les systèmes de type Unix)
MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike= Nom host ou ip du serveur SMTP/SMTPS (Non défini dans le PHP sur les systèmes de type Unix)
MAIN_MAIL_EMAIL_FROM= EMail émetteur pour envoi emails automatiques (Par défaut dans php.ini: <b>%s</b>)
MAIN_MAIL_AUTOCOPY_TO= Envoyer systématiquement une copie cachée des mails envoyés à
MAIN_DISABLE_ALL_MAILS= Désactiver globalement tout envoi de mails (pour mode test ou démos)
MAIN_MAIL_SENDMODE= Méthode d'envoi des mails
MAIN_MAIL_SMTPS_ID= SMTP Authentification ID si authentification SMTP requise

View File

@ -24,7 +24,7 @@
/**
* \file htdocs/lib/CMailFile.class.php
* \brief Fichier de la classe permettant d'envoyer des mail avec attachements
* \brief File of class to send emails (with attachments or not)
* \version $Id$
* \author Dan Potter.
* \author Eric Seigne
@ -33,7 +33,7 @@
/**
* \class CMailFile
* \brief Classe d'envoi de mails et pieces jointes. Encapsule mail() avec d'eventuels attachements.
* \brief Class to send emails (with attachments or not)
* \remarks Usage: $mailfile = new CMailFile($subject,$sendto,$replyto,$message,$filepath,$mimetype,$filename,$cc,$ccc,$deliveryreceipt,$msgishtml,$errors_to);
* \remarks $mailfile->sendfile();
*/
@ -165,6 +165,9 @@ class CMailFile
}
}
// Add autocopy to
if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_TO)) $addr_bcc.=($addr_bcc?', ':'').$conf->global->MAIN_MAIL_AUTOCOPY_TO;
// Action according to choosed sending method
if ($conf->global->MAIN_MAIL_SENDMODE == 'mail')
{

View File

@ -1512,7 +1512,7 @@ function img_mime($file,$alt='')
/**
* \brief Show information for admin users
* \param text Text info
* \param infoonimgalt Info is shown on alt of star picto, otherwise it is show on output
* \param infoonimgalt Info is shown only on alt of star picto, otherwise it is show on output after the star picto
* \return string String with info text
*/
function info_admin($texte,$infoonimgalt=0)