diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index ab12d1419b6a41c3136a9cd72aa6ec7aa41a03a9..05b12ff10b85fff2c3207cdb789fc5b529793097 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -20,7 +20,7 @@ /** * \file htdocs/admin/mails.php * \brief Page to setup emails sending - * \version $Id: mails.php,v 1.71 2011/07/09 05:28:41 hregis Exp $ + * \version $Id: mails.php,v 1.72 2011/07/09 06:10:06 hregis Exp $ */ require("../main.inc.php"); @@ -63,6 +63,7 @@ if (isset($_POST["action"]) && $_POST["action"] == 'update' && empty($_POST["can 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_ERRORS_TO", $_POST["MAIN_MAIL_ERRORS_TO"],'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"); @@ -467,6 +468,12 @@ if (isset($_GET["action"]) && $_GET["action"] == 'edit') 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>'; + + // From + $var=!$var; + print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_ERRORS_TO").'</td>'; + print '<td><input class="flat" name="MAIN_MAIL_ERRORS_TO" size="32" value="' . $conf->global->MAIN_MAIL_ERRORS_TO; + print '"></td></tr>'; // Autocopy to $var=!$var; @@ -567,6 +574,13 @@ else 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>'; + + // Errors To + $var=!$var; + print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_ERRORS_TO").'</td>'; + print '<td>'.$conf->global->MAIN_MAIL_ERRORS_TO; + if (!empty($conf->global->MAIN_MAIL_ERRORS_TO) && ! isValidEmail($conf->global->MAIN_MAIL_ERRORS_TO)) print img_warning($langs->trans("ErrorBadEMail")); + print '</td></tr>'; // Autocopy to $var=!$var; @@ -723,5 +737,5 @@ else $db->close(); -llxFooter('$Date: 2011/07/09 05:28:41 $ - $Revision: 1.71 $'); +llxFooter('$Date: 2011/07/09 06:10:06 $ - $Revision: 1.72 $'); ?> diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index ebfdded98daa8cd489e7714bf487defd849274a0..25c96d5449831ed963bd6e3d2fe54f32bd2b4342 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -21,7 +21,7 @@ * \file htdocs/core/class/html.formmail.class.php * \ingroup core * \brief Fichier de la classe permettant la generation du formulaire html d'envoi de mail unitaire - * \version $Id: html.formmail.class.php,v 1.28 2011/07/07 15:54:03 simnandez Exp $ + * \version $Id: html.formmail.class.php,v 1.29 2011/07/09 06:10:07 hregis Exp $ */ require_once(DOL_DOCUMENT_ROOT ."/core/class/html.form.class.php"); @@ -309,17 +309,18 @@ class FormMail if ($this->witherrorsto) { //if (! $this->errorstomail) $this->errorstomail=$this->frommail; + $errorstomail = (! empty($conf->global->MAIN_MAIL_ERRORS_TO) ? $conf->global->MAIN_MAIL_ERRORS_TO : $this->errorstomail); if ($this->witherrorstoreadonly) { - $out.= '<input type="hidden" id="errorstomail" name="errorstomail" value="'.$this->errorstomail.'" />'; + $out.= '<input type="hidden" id="errorstomail" name="errorstomail" value="'.$errorstomail.'" />'; $out.= '<tr><td>'.$langs->trans("MailErrorsTo").'</td><td>'; - $out.= $this->errorstomail; + $out.= $errorstomail; $out.= "</td></tr>\n"; } else { $out.= '<tr><td>'.$langs->trans("MailErrorsTo").'</td><td>'; - $out.= '<input size="30" id="errorstomail" name="errorstomail" value="'.$this->errorstomail.'" />'; + $out.= '<input size="30" id="errorstomail" name="errorstomail" value="'.$errorstomail.'" />'; $out.= "</td></tr>\n"; } } diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 9f153916ea5fe7c5c03be756d2002f5c91b790be..0f43c1c9e826696b617219492d73c6451e8bf07f 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -229,6 +229,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_ERRORS_TO=Sender e-mail 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 e-mails sendings (for test purposes or demos) MAIN_MAIL_SENDMODE=Method to use to send EMails diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 2729073a3b8c871002c55c8e3740adbac9e3b551..3cb19e89ba84b863d8ed5240fe478fcaea5ebcdb 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -230,6 +230,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_ERRORS_TO=EMail utilisé pour les retours d'erreurs des mails envoyés 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 diff --git a/htdocs/lib/CMailFile.class.php b/htdocs/lib/CMailFile.class.php index 020c8c45aaee418abddb2b5fb078c0f5407094e3..bc0681147407b1b97ade34a4a3b645dd4c0eae6f 100644 --- a/htdocs/lib/CMailFile.class.php +++ b/htdocs/lib/CMailFile.class.php @@ -25,7 +25,7 @@ /** * \file htdocs/lib/CMailFile.class.php * \brief File of class to send emails (with attachments or not) - * \version $Id: CMailFile.class.php,v 1.144 2011/07/08 17:33:00 hregis Exp $ + * \version $Id: CMailFile.class.php,v 1.145 2011/07/09 06:10:04 hregis Exp $ * \author Dan Potter. * \author Eric Seigne * \author Laurent Destailleur. @@ -349,7 +349,7 @@ class CMailFile // le return-path dans les header ne fonctionne pas avec tous les MTA // Le passage par -f est donc possible si la constante MAIN_MAIL_ALLOW_SENDMAIL_F est definie. // La variable definie pose des pb avec certains sendmail securisee (option -f refusee car dangereuse) - $bounce = $this->addr_from != '' ? '-f' . $this->addr_from : ''; + $bounce = (! empty($conf->global->MAIN_MAIL_ERRORS_TO) ? '-f' . $conf->global->MAIN_MAIL_ERRORS_TO : ($this->addr_from != '' ? '-f' . $this->addr_from : '') ); } $this->message=stripslashes($this->message);