Le parametre errors_to est gere par le constructeur de la classe CMailFile
This commit is contained in:
parent
009fcfb6bc
commit
2d5e0e9de4
@ -68,6 +68,7 @@ if ($_POST["action"] == 'send' && ! $_POST["cancel"])
|
|||||||
$filename = array();
|
$filename = array();
|
||||||
|
|
||||||
$email_from = $conf->global->MAIN_MAIL_EMAIL_FROM;
|
$email_from = $conf->global->MAIN_MAIL_EMAIL_FROM;
|
||||||
|
$errors_to = $_POST["errorstomail"];
|
||||||
$sendto = $_POST["sendto"];
|
$sendto = $_POST["sendto"];
|
||||||
$subject = $_POST['subject'];
|
$subject = $_POST['subject'];
|
||||||
$body = $_POST['message'];
|
$body = $_POST['message'];
|
||||||
@ -97,7 +98,7 @@ if ($_POST["action"] == 'send' && ! $_POST["cancel"])
|
|||||||
|
|
||||||
$mailfile = new CMailFile($subject,$sendto,$email_from,$body,
|
$mailfile = new CMailFile($subject,$sendto,$email_from,$body,
|
||||||
$filepath,$mimetype,$filename,
|
$filepath,$mimetype,$filename,
|
||||||
'', '', 0, $msgishtml);
|
'', '', 0, $msgishtml,$errors_to);
|
||||||
|
|
||||||
$result=$mailfile->sendfile();
|
$result=$mailfile->sendfile();
|
||||||
if ($result)
|
if ($result)
|
||||||
@ -206,6 +207,7 @@ else
|
|||||||
$formmail->frommail = $conf->global->MAIN_MAIL_EMAIL_FROM;
|
$formmail->frommail = $conf->global->MAIN_MAIL_EMAIL_FROM;
|
||||||
$formmail->withsubstit=0;
|
$formmail->withsubstit=0;
|
||||||
$formmail->withfrom=1;
|
$formmail->withfrom=1;
|
||||||
|
$formmail->witherrorsto=1;
|
||||||
$formmail->withto=$user->email?$user->email:1;
|
$formmail->withto=$user->email?$user->email:1;
|
||||||
$formmail->withcc=0;
|
$formmail->withcc=0;
|
||||||
$formmail->withtopic=$langs->trans("Test");
|
$formmail->withtopic=$langs->trans("Test");
|
||||||
|
|||||||
@ -211,8 +211,7 @@ class RejetPrelevement
|
|||||||
|
|
||||||
$mailfile = new CMailFile($subject,$sendto,$from,$message,
|
$mailfile = new CMailFile($subject,$sendto,$from,$message,
|
||||||
$arr_file,$arr_mime,$arr_name,
|
$arr_file,$arr_mime,$arr_name,
|
||||||
'', '', 0, $msgishtml);
|
'', '', 0, $msgishtml,$this->user->email);
|
||||||
$mailfile->errors_to = $this->user->email;
|
|
||||||
|
|
||||||
$result=$mailfile->sendfile();
|
$result=$mailfile->sendfile();
|
||||||
if ($result)
|
if ($result)
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<?PHP
|
<?PHP
|
||||||
/* Copyright (C) 2005-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2005-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -80,6 +80,7 @@ class FormMail
|
|||||||
$this->withfrom=1;
|
$this->withfrom=1;
|
||||||
$this->withto=1;
|
$this->withto=1;
|
||||||
$this->withtocc=1;
|
$this->withtocc=1;
|
||||||
|
$this->witherrorsto=0;
|
||||||
$this->withtopic=1;
|
$this->withtopic=1;
|
||||||
$this->withfile=0;
|
$this->withfile=0;
|
||||||
$this->withbody=1;
|
$this->withbody=1;
|
||||||
@ -88,6 +89,7 @@ class FormMail
|
|||||||
$this->withreplytoreadonly=1;
|
$this->withreplytoreadonly=1;
|
||||||
$this->withtoreadonly=0;
|
$this->withtoreadonly=0;
|
||||||
$this->withtoccreadonly=0;
|
$this->withtoccreadonly=0;
|
||||||
|
$this->witherrorstoreadonly=0;
|
||||||
$this->withtopicreadonly=0;
|
$this->withtopicreadonly=0;
|
||||||
$this->withbodyreadonly=0;
|
$this->withbodyreadonly=0;
|
||||||
$this->withdeliveryreceiptreadonly=0;
|
$this->withdeliveryreceiptreadonly=0;
|
||||||
@ -153,6 +155,25 @@ class FormMail
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Errorsto
|
||||||
|
if ($this->witherrorsto)
|
||||||
|
{
|
||||||
|
//if (! $this->errorstomail) $this->errorstomail=$this->frommail;
|
||||||
|
if ($this->witherrorstoreadonly)
|
||||||
|
{
|
||||||
|
print '<input type="hidden" name="errorstomail" value="'.$this->errorstomail.'">';
|
||||||
|
print "<tr><td>".$langs->trans("MailErrorsTo")."</td><td>";
|
||||||
|
print $this->errorstomail;
|
||||||
|
print "</td></tr>\n";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print "<tr><td>".$langs->trans("MailErrorsTo")."</td><td>";
|
||||||
|
print "<input size=\"30\" name=\"errorstomail\" value=\"".$this->errorstomail."\">";
|
||||||
|
print "</td></tr>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// To
|
// To
|
||||||
if ($this->withto || is_array($this->withto))
|
if ($this->withto || is_array($this->withto))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -9,6 +9,7 @@ MailRecipients=Recipients
|
|||||||
MailRecipient=Recipient
|
MailRecipient=Recipient
|
||||||
MailTitle=Title
|
MailTitle=Title
|
||||||
MailFrom=Sender
|
MailFrom=Sender
|
||||||
|
MailErrorsTo=Errors to
|
||||||
MailReply=Reply to
|
MailReply=Reply to
|
||||||
MailTo=Receiver(s)
|
MailTo=Receiver(s)
|
||||||
MailCC=Copy to
|
MailCC=Copy to
|
||||||
|
|||||||
@ -9,6 +9,7 @@ MailRecipients=Destinataires
|
|||||||
MailRecipient=Destinataire
|
MailRecipient=Destinataire
|
||||||
MailTitle=Titre
|
MailTitle=Titre
|
||||||
MailFrom=Émetteur
|
MailFrom=Émetteur
|
||||||
|
MailErrorsTo=Erreurs à
|
||||||
MailReply=Réponse ŕ
|
MailReply=Réponse ŕ
|
||||||
MailTo=Destinataire(s)
|
MailTo=Destinataire(s)
|
||||||
MailCC=Copie ŕ
|
MailCC=Copie ŕ
|
||||||
|
|||||||
@ -48,9 +48,11 @@ class CMailFile
|
|||||||
{
|
{
|
||||||
var $subject;
|
var $subject;
|
||||||
var $addr_from;
|
var $addr_from;
|
||||||
|
var $errors_to;
|
||||||
var $addr_to;
|
var $addr_to;
|
||||||
var $addr_cc;
|
var $addr_cc;
|
||||||
var $addr_bcc;
|
var $addr_bcc;
|
||||||
|
|
||||||
var $mime_boundary;
|
var $mime_boundary;
|
||||||
var $deliveryreceipt;
|
var $deliveryreceipt;
|
||||||
|
|
||||||
@ -75,9 +77,9 @@ class CMailFile
|
|||||||
*/
|
*/
|
||||||
function CMailFile($subject,$to,$from,$msg,
|
function CMailFile($subject,$to,$from,$msg,
|
||||||
$filename_list=array(),$mimetype_list=array(),$mimefilename_list=array(),
|
$filename_list=array(),$mimetype_list=array(),$mimefilename_list=array(),
|
||||||
$addr_cc="",$addr_bcc="",$deliveryreceipt=0,$msgishtml=0)
|
$addr_cc="",$addr_bcc="",$deliveryreceipt=0,$msgishtml=0, $errors_to='')
|
||||||
{
|
{
|
||||||
dolibarr_syslog("CMailFile::CMailfile: from=$from, to=$to, addr_cc=$addr_cc, addr_bcc=$addr_bcc");
|
dolibarr_syslog("CMailFile::CMailfile: from=$from, to=$to, addr_cc=$addr_cc, addr_bcc=$addr_bcc, errors_to=$errors_to");
|
||||||
dolibarr_syslog("CMailFile::CMailfile: subject=$subject, deliveryreceipt=$deliveryreceipt, msgishtml=$msgishtml");
|
dolibarr_syslog("CMailFile::CMailfile: subject=$subject, deliveryreceipt=$deliveryreceipt, msgishtml=$msgishtml");
|
||||||
foreach ($filename_list as $i => $val)
|
foreach ($filename_list as $i => $val)
|
||||||
{
|
{
|
||||||
@ -107,6 +109,7 @@ class CMailFile
|
|||||||
// En-tete dans $smtp_headers
|
// En-tete dans $smtp_headers
|
||||||
$this->subject = $subject;
|
$this->subject = $subject;
|
||||||
$this->addr_from = $from;
|
$this->addr_from = $from;
|
||||||
|
$this->errors_to = $errors_to;
|
||||||
$this->addr_to = $to;
|
$this->addr_to = $to;
|
||||||
$this->addr_cc = $addr_cc;
|
$this->addr_cc = $addr_cc;
|
||||||
$this->addr_bcc = $addr_bcc;
|
$this->addr_bcc = $addr_bcc;
|
||||||
@ -172,7 +175,7 @@ class CMailFile
|
|||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
dolibarr_syslog("CMailFile::sendfile addr_from=".$this->addr_from.", addr_to=".$this->addr_to.", subject=".$this->subject);
|
dolibarr_syslog("CMailFile::sendfile addr_to=".$this->addr_to.", subject=".$this->subject);
|
||||||
dolibarr_syslog("CMailFile::sendfile header=\n".$this->headers);
|
dolibarr_syslog("CMailFile::sendfile header=\n".$this->headers);
|
||||||
//dolibarr_syslog("CMailFile::sendfile message=\n".$message);
|
//dolibarr_syslog("CMailFile::sendfile message=\n".$message);
|
||||||
//$this->send_to_file();
|
//$this->send_to_file();
|
||||||
@ -205,6 +208,7 @@ class CMailFile
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
/* Le errors_to doit se gerer dans en-tete http et non par option -f
|
||||||
if ($this->errors_to)
|
if ($this->errors_to)
|
||||||
{
|
{
|
||||||
// \TODO Tester que le safe_mode est inactif car fonction mail avec ces param non dispo en safe_mode
|
// \TODO Tester que le safe_mode est inactif car fonction mail avec ces param non dispo en safe_mode
|
||||||
@ -212,11 +216,11 @@ class CMailFile
|
|||||||
$res = mail($dest,$this->subject,stripslashes($this->message),$this->headers,"-f".getValidAddress($this->errors_to,2));
|
$res = mail($dest,$this->subject,stripslashes($this->message),$this->headers,"-f".getValidAddress($this->errors_to,2));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{*/
|
||||||
dolibarr_syslog("CMailFile::sendfile: mail start SMTP=".ini_get('SMTP').", PORT=".ini_get('smtp_port'));
|
dolibarr_syslog("CMailFile::sendfile: mail start SMTP=".ini_get('SMTP').", PORT=".ini_get('smtp_port'));
|
||||||
//dolibarr_syslog("to=".getValidAddress($this->addr_to,2).", subject=".$this->subject.", message=".stripslashes($this->message).", header=".$this->headers);
|
//dolibarr_syslog("to=".getValidAddress($this->addr_to,2).", subject=".$this->subject.", message=".stripslashes($this->message).", header=".$this->headers);
|
||||||
$res = mail($dest,$this->subject,stripslashes($this->message),$this->headers);
|
$res = mail($dest,$this->subject,stripslashes($this->message),$this->headers);
|
||||||
}
|
/* } */
|
||||||
if (! $res)
|
if (! $res)
|
||||||
{
|
{
|
||||||
$this->error="Failed to send mail to SMTP=".ini_get('SMTP').", PORT=".ini_get('smtp_port')."<br>Check your server logs and your firewalls setup";
|
$this->error="Failed to send mail to SMTP=".ini_get('SMTP').", PORT=".ini_get('smtp_port')."<br>Check your server logs and your firewalls setup";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user