Fix: removed obsolete code

This commit is contained in:
Regis Houssin 2009-05-18 06:25:45 +00:00
parent e84a913af6
commit 364c247405

View File

@ -1,7 +1,8 @@
<?php <?php
/* Copyright (C) 2000-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2000-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org> * Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
* *
* 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
@ -109,12 +110,6 @@ class CMailFile
// On defini alternative_boundary // On defini alternative_boundary
$this->alternative_boundary = md5(uniqid("dolibarr")); $this->alternative_boundary = md5(uniqid("dolibarr"));
// Evite caractere bizarre avec les accents
//Todo l'envoi par mailing donne des caractères bizarre,
// alors que l'envoi d'un document facture ou autre est correcte
$subject = $subject;
$from = $from;
// If ending method not defined // If ending method not defined
if (empty($conf->global->MAIN_MAIL_SENDMODE)) $conf->global->MAIN_MAIL_SENDMODE='mail'; if (empty($conf->global->MAIN_MAIL_SENDMODE)) $conf->global->MAIN_MAIL_SENDMODE='mail';
@ -215,7 +210,7 @@ class CMailFile
} }
else if ($conf->global->MAIN_MAIL_SENDMODE == 'simplemail') else if ($conf->global->MAIN_MAIL_SENDMODE == 'simplemail')
{ {
// Todo: Use simplemail library // Use simplemail library
// ------------------------------------------ // ------------------------------------------
require_once(DOL_DOCUMENT_ROOT."/includes/simplemail/class.mail.php"); require_once(DOL_DOCUMENT_ROOT."/includes/simplemail/class.mail.php");
@ -229,58 +224,49 @@ class CMailFile
$mail->XMailer = "Dolibarr version " . DOL_VERSION ." (using simplemail)"; $mail->XMailer = "Dolibarr version " . DOL_VERSION ." (using simplemail)";
// Ajout de l'expediteur // Add from
$this->addr_from = $from; $this->addr_from = $from;
//$this->splitAddress($from);
//$mail->addfrom($this->sEmail,$this->sName);
$mail->hfrom=$this->getValidAddress($this->addr_from,0,1); $mail->hfrom=$this->getValidAddress($this->addr_from,0,1);
// Ajout accuse reception // Add delivery receipt
if ($deliveryreceipt) if ($deliveryreceipt)
{ {
//$mail->adddeliveryreceipt($this->sEmail,$this->sName);
$mail->deliveryreceipt=$this->getValidAddress($this->addr_from,0,1); $mail->deliveryreceipt=$this->getValidAddress($this->addr_from,0,1);
} }
// Ajout du destinataire // Add to
$arrayTo=split(',',$to); $arrayTo=split(',',$to);
foreach($arrayTo as $val) foreach($arrayTo as $val)
{ {
//$this->splitAddress($val);
//$mail->addrecipient($this->sEmail,$this->sName);
$mail->recipientlist[] = array( 'mail'=>$this->getValidAddress($val,2), 'nameplusmail' => $this->getValidAddress($val,0,1)); $mail->recipientlist[] = array( 'mail'=>$this->getValidAddress($val,2), 'nameplusmail' => $this->getValidAddress($val,0,1));
} }
// Ajout carbon copy // Add carbon copy
if (!empty($addr_cc)) if (!empty($addr_cc))
{ {
$arrayTocc=split(',',$addr_cc); $arrayTocc=split(',',$addr_cc);
foreach($arrayTocc as $val) foreach($arrayTocc as $val)
{ {
//$this->splitAddress($val);
//$mail->addcc($this->sEmail,$this->sName);
if (!empty($mail->hcc)) $mail->hcc.= ","; if (!empty($mail->hcc)) $mail->hcc.= ",";
$mail->hcc.= $this->getValidAddress($val,0,1); $mail->hcc.= $this->getValidAddress($val,0,1);
} }
} }
// Ajout carbon copy cache // Add carbon copy cache
if (!empty($addr_bcc)) if (!empty($addr_bcc))
{ {
$arrayTobcc=split(',',$addr_bcc); $arrayTobcc=split(',',$addr_bcc);
foreach($arrayTobcc as $val) foreach($arrayTobcc as $val)
{ {
//$this->splitAddress($val);
//$mail->addbcc($this->sEmail,$this->sName);
if (!empty($mail->hbcc)) $mail->hbcc.= ","; if (!empty($mail->hbcc)) $mail->hbcc.= ",";
$mail->hbcc.= $this->getValidAddress($val,0,1); $mail->hbcc.= $this->getValidAddress($val,0,1);
} }
} }
//ajout du sujet // Add subject
$mail->addsubject($this->encodetorfc2822($subject)); $mail->addsubject($this->encodetorfc2822($subject));
// Ajout du message // Add message
if ($this->msgishtml) if ($this->msgishtml)
{ {
if (! empty($this->html)) if (! empty($this->html))
@ -297,16 +283,16 @@ class CMailFile
} }
} }
} }
// le message format html // HTML format
$mail->html = $msg; $mail->html = $msg;
} }
else else
{ {
// le message format text // Text format
$mail->text = $msg; $mail->text = $msg;
} }
// une piece jointe. // Attach-files
if ($this->atleastonefile) if ($this->atleastonefile)
{ {
foreach ($filename_list as $i => $val) foreach ($filename_list as $i => $val)
@ -945,22 +931,6 @@ class CMailFile
} }
} }
function splitAddress($address)
{
if (eregi('^(.*)<(.*)>$',trim($address),$regs))
{
$this->sName = trim(utf8_decode($regs[1]));
$this->sEmail = trim($regs[2]);
}
else
{
$this->sName = '';
$this->sEmail = $address;
}
}
/** /**
* \brief Return an address for SMTP protocol * \brief Return an address for SMTP protocol
* \param adresses Example: 'John Doe <john@doe.com>' or 'john@doe.com' * \param adresses Example: 'John Doe <john@doe.com>' or 'john@doe.com'