Skip to content
Snippets Groups Projects
Commit 82d97b1e authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Can add a field errors-to to emailings

parent c50d2cea
Branches
Tags
No related merge requests found
...@@ -115,6 +115,7 @@ if ($_POST["action"] == 'sendallconfirmed' && $_POST['confirm'] == 'yes') ...@@ -115,6 +115,7 @@ if ($_POST["action"] == 'sendallconfirmed' && $_POST['confirm'] == 'yes')
$subject = $mil->sujet; $subject = $mil->sujet;
$message = $mil->body; $message = $mil->body;
$from = $mil->email_from; $from = $mil->email_from;
$replyto = $mil->email_replyto;
$errorsto = $mil->email_errorsto; $errorsto = $mil->email_errorsto;
// Le message est-il en html // Le message est-il en html
$msgishtml=-1; // Unknown by default $msgishtml=-1; // Unknown by default
...@@ -188,9 +189,7 @@ if ($_POST["action"] == 'sendallconfirmed' && $_POST['confirm'] == 'yes') ...@@ -188,9 +189,7 @@ if ($_POST["action"] == 'sendallconfirmed' && $_POST['confirm'] == 'yes')
// Fabrication du mail // Fabrication du mail
$mail = new CMailFile($newsubject, $sendto, $from, $newmessage, $mail = new CMailFile($newsubject, $sendto, $from, $newmessage,
array(), array(), array(), array(), array(), array(),
'', '', 0, $msgishtml); '', '', 0, $msgishtml, $errorsto);
$mail->errors_to = $errorsto;
if ($mail->error) if ($mail->error)
{ {
...@@ -202,7 +201,7 @@ if ($_POST["action"] == 'sendallconfirmed' && $_POST['confirm'] == 'yes') ...@@ -202,7 +201,7 @@ if ($_POST["action"] == 'sendallconfirmed' && $_POST['confirm'] == 'yes')
$res=0; $res=0;
} }
// Envoi du mail // Send mail
if ($res) if ($res)
{ {
$res=$mail->sendfile(); $res=$mail->sendfile();
...@@ -210,7 +209,7 @@ if ($_POST["action"] == 'sendallconfirmed' && $_POST['confirm'] == 'yes') ...@@ -210,7 +209,7 @@ if ($_POST["action"] == 'sendallconfirmed' && $_POST['confirm'] == 'yes')
if ($res) if ($res)
{ {
// Mail envoye avec succes // Mail successful
$nbok++; $nbok++;
dol_syslog("mailing-send: ok for #".$i.($mail->error?' - '.$mail->error:''), LOG_DEBUG); dol_syslog("mailing-send: ok for #".$i.($mail->error?' - '.$mail->error:''), LOG_DEBUG);
...@@ -225,7 +224,7 @@ if ($_POST["action"] == 'sendallconfirmed' && $_POST['confirm'] == 'yes') ...@@ -225,7 +224,7 @@ if ($_POST["action"] == 'sendallconfirmed' && $_POST['confirm'] == 'yes')
} }
else else
{ {
// Mail en echec // Mail failed
$nbko++; $nbko++;
dol_syslog("mailing-send: error for #".$i.($mail->error?' - '.$mail->error:''), LOG_DEBUG); dol_syslog("mailing-send: error for #".$i.($mail->error?' - '.$mail->error:''), LOG_DEBUG);
......
...@@ -17,9 +17,6 @@ ...@@ -17,9 +17,6 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* *
* $Id$
* $Source$
*
* *
* !!! Envoi mailing !!! * !!! Envoi mailing !!!
* *
...@@ -39,16 +36,17 @@ ...@@ -39,16 +36,17 @@
/** /**
\file scripts/mailing/mailing-send.php * \file scripts/mailing/mailing-send.php
\ingroup mailing * \ingroup mailing
\brief Script d'envoi d'un mailing pr�par� et valid� * \brief Script d'envoi d'un mailing prepare et valide
* \version $Id$
*/ */
// Test si mode batch // Test if CLI mode
$sapi_type = php_sapi_name(); $sapi_type = php_sapi_name();
if (substr($sapi_type, 0, 3) == 'cgi') { if (substr($sapi_type, 0, 3) == 'cgi') {
echo "Erreur: Vous utilisez l'interpreteur PHP pour le mode CGI. Pour executer mailing-send.php en ligne de commande, vous devez utiliser l'interpreteur PHP pour le mode CLI.\n"; echo "Error: You are using PH for CGI/Web. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
exit; exit;
} }
...@@ -69,9 +67,9 @@ require_once (DOL_DOCUMENT_ROOT."/lib/CMailFile.class.php"); ...@@ -69,9 +67,9 @@ require_once (DOL_DOCUMENT_ROOT."/lib/CMailFile.class.php");
$error = 0; $error = 0;
// On r�cup�re donn�es du mail // We read data of email
$sql = "SELECT m.rowid, m.titre, m.sujet, m.body"; $sql = "SELECT m.rowid, m.titre, m.sujet, m.body,";
$sql .= " , m.email_from, m.email_replyto, m.email_errorsto"; $sql.= " m.email_from, m.email_replyto, m.email_errorsto";
$sql.= " FROM ".MAIN_DB_PREFIX."mailing as m"; $sql.= " FROM ".MAIN_DB_PREFIX."mailing as m";
$sql.= " WHERE m.statut >= 1"; $sql.= " WHERE m.statut >= 1";
$sql.= " AND m.rowid= ".$id; $sql.= " AND m.rowid= ".$id;
...@@ -93,6 +91,7 @@ if ($resql) ...@@ -93,6 +91,7 @@ if ($resql)
$subject = $obj->sujet; $subject = $obj->sujet;
$message = $obj->body; $message = $obj->body;
$from = $obj->email_from; $from = $obj->email_from;
$replyto = $obj->email_replyto;
$errorsto = $obj->email_errorsto; $errorsto = $obj->email_errorsto;
// Le message est-il en html // Le message est-il en html
...@@ -166,9 +165,7 @@ if ($resql) ...@@ -166,9 +165,7 @@ if ($resql)
// Fabrication du mail // Fabrication du mail
$mail = new CMailFile($newsubject, $sendto, $from, $newmessage, $mail = new CMailFile($newsubject, $sendto, $from, $newmessage,
array(), array(), array(), array(), array(), array(),
'', '', 0, $msgishtml); '', '', 0, $msgishtml, $errorsto);
$mail->errors_to = $errorsto;
if ($mail->error) if ($mail->error)
{ {
...@@ -180,7 +177,7 @@ if ($resql) ...@@ -180,7 +177,7 @@ if ($resql)
$res=0; $res=0;
} }
// Envoi du mail // Send Email
if ($res) if ($res)
{ {
$res=$mail->sendfile(); $res=$mail->sendfile();
...@@ -188,7 +185,7 @@ if ($resql) ...@@ -188,7 +185,7 @@ if ($resql)
if ($res) if ($res)
{ {
// Mail envoye avec succes // Mail successful
$nbok++; $nbok++;
dol_syslog("mailing-send: ok for #".$i.($mail->error?' - '.$mail->error:''), LOG_DEBUG); dol_syslog("mailing-send: ok for #".$i.($mail->error?' - '.$mail->error:''), LOG_DEBUG);
...@@ -203,7 +200,7 @@ if ($resql) ...@@ -203,7 +200,7 @@ if ($resql)
} }
else else
{ {
// Mail en echec // Mail failed
$nbko++; $nbko++;
dol_syslog("mailing-send: error for #".$i.($mail->error?' - '.$mail->error:''), LOG_DEBUG); dol_syslog("mailing-send: error for #".$i.($mail->error?' - '.$mail->error:''), LOG_DEBUG);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment