Can add a field errors-to to emailings
This commit is contained in:
parent
c50d2cea03
commit
82d97b1ee1
@ -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
|
||||||
@ -187,10 +188,8 @@ 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')
|
|||||||
$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')
|
|||||||
|
|
||||||
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')
|
|||||||
}
|
}
|
||||||
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 @@
|
|||||||
* 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 @@
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file scripts/mailing/mailing-send.php
|
* \file scripts/mailing/mailing-send.php
|
||||||
\ingroup mailing
|
* \ingroup mailing
|
||||||
\brief Script d'envoi d'un mailing pr<EFBFBD>par<EFBFBD> et valid<EFBFBD>
|
* \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,13 +67,13 @@ require_once (DOL_DOCUMENT_ROOT."/lib/CMailFile.class.php");
|
|||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
|
|
||||||
// On r<>cup<75>re donn<6E>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;
|
||||||
$sql .= " LIMIT 1";
|
$sql.= " LIMIT 1";
|
||||||
|
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
if ($resql)
|
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)
|
|||||||
// 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)
|
|||||||
$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)
|
|||||||
|
|
||||||
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)
|
|||||||
}
|
}
|
||||||
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);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user