forked from Wavyzz/dolibarr
Le parametre errors_to est gere par le constructeur de la classe CMailFile
This commit is contained in:
@@ -68,6 +68,7 @@ if ($_POST["action"] == 'send' && ! $_POST["cancel"])
|
||||
$filename = array();
|
||||
|
||||
$email_from = $conf->global->MAIN_MAIL_EMAIL_FROM;
|
||||
$errors_to = $_POST["errorstomail"];
|
||||
$sendto = $_POST["sendto"];
|
||||
$subject = $_POST['subject'];
|
||||
$body = $_POST['message'];
|
||||
@@ -97,7 +98,7 @@ if ($_POST["action"] == 'send' && ! $_POST["cancel"])
|
||||
|
||||
$mailfile = new CMailFile($subject,$sendto,$email_from,$body,
|
||||
$filepath,$mimetype,$filename,
|
||||
'', '', 0, $msgishtml);
|
||||
'', '', 0, $msgishtml,$errors_to);
|
||||
|
||||
$result=$mailfile->sendfile();
|
||||
if ($result)
|
||||
@@ -206,6 +207,7 @@ else
|
||||
$formmail->frommail = $conf->global->MAIN_MAIL_EMAIL_FROM;
|
||||
$formmail->withsubstit=0;
|
||||
$formmail->withfrom=1;
|
||||
$formmail->witherrorsto=1;
|
||||
$formmail->withto=$user->email?$user->email:1;
|
||||
$formmail->withcc=0;
|
||||
$formmail->withtopic=$langs->trans("Test");
|
||||
|
||||
@@ -211,8 +211,7 @@ class RejetPrelevement
|
||||
|
||||
$mailfile = new CMailFile($subject,$sendto,$from,$message,
|
||||
$arr_file,$arr_mime,$arr_name,
|
||||
'', '', 0, $msgishtml);
|
||||
$mailfile->errors_to = $this->user->email;
|
||||
'', '', 0, $msgishtml,$this->user->email);
|
||||
|
||||
$result=$mailfile->sendfile();
|
||||
if ($result)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -80,6 +80,7 @@ class FormMail
|
||||
$this->withfrom=1;
|
||||
$this->withto=1;
|
||||
$this->withtocc=1;
|
||||
$this->witherrorsto=0;
|
||||
$this->withtopic=1;
|
||||
$this->withfile=0;
|
||||
$this->withbody=1;
|
||||
@@ -88,6 +89,7 @@ class FormMail
|
||||
$this->withreplytoreadonly=1;
|
||||
$this->withtoreadonly=0;
|
||||
$this->withtoccreadonly=0;
|
||||
$this->witherrorstoreadonly=0;
|
||||
$this->withtopicreadonly=0;
|
||||
$this->withbodyreadonly=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
|
||||
if ($this->withto || is_array($this->withto))
|
||||
{
|
||||
|
||||
@@ -9,6 +9,7 @@ MailRecipients=Recipients
|
||||
MailRecipient=Recipient
|
||||
MailTitle=Title
|
||||
MailFrom=Sender
|
||||
MailErrorsTo=Errors to
|
||||
MailReply=Reply to
|
||||
MailTo=Receiver(s)
|
||||
MailCC=Copy to
|
||||
|
||||
@@ -9,6 +9,7 @@ MailRecipients=Destinataires
|
||||
MailRecipient=Destinataire
|
||||
MailTitle=Titre
|
||||
MailFrom=<3D>metteur
|
||||
MailErrorsTo=Erreurs <20>
|
||||
MailReply=R<>ponse <20>
|
||||
MailTo=Destinataire(s)
|
||||
MailCC=Copie <20>
|
||||
|
||||
@@ -48,9 +48,11 @@ class CMailFile
|
||||
{
|
||||
var $subject;
|
||||
var $addr_from;
|
||||
var $errors_to;
|
||||
var $addr_to;
|
||||
var $addr_cc;
|
||||
var $addr_bcc;
|
||||
|
||||
var $mime_boundary;
|
||||
var $deliveryreceipt;
|
||||
|
||||
@@ -75,9 +77,9 @@ class CMailFile
|
||||
*/
|
||||
function CMailFile($subject,$to,$from,$msg,
|
||||
$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");
|
||||
foreach ($filename_list as $i => $val)
|
||||
{
|
||||
@@ -107,6 +109,7 @@ class CMailFile
|
||||
// En-tete dans $smtp_headers
|
||||
$this->subject = $subject;
|
||||
$this->addr_from = $from;
|
||||
$this->errors_to = $errors_to;
|
||||
$this->addr_to = $to;
|
||||
$this->addr_cc = $addr_cc;
|
||||
$this->addr_bcc = $addr_bcc;
|
||||
@@ -172,7 +175,7 @@ class CMailFile
|
||||
{
|
||||
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 message=\n".$message);
|
||||
//$this->send_to_file();
|
||||
@@ -205,6 +208,7 @@ class CMailFile
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Le errors_to doit se gerer dans en-tete http et non par option -f
|
||||
if ($this->errors_to)
|
||||
{
|
||||
// \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));
|
||||
}
|
||||
else
|
||||
{
|
||||
{*/
|
||||
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);
|
||||
$res = mail($dest,$this->subject,stripslashes($this->message),$this->headers);
|
||||
}
|
||||
/* } */
|
||||
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";
|
||||
|
||||
Reference in New Issue
Block a user