This commit is contained in:
Laurent Destailleur 2018-03-11 19:44:19 +01:00
parent 2245a2eaf6
commit b084ca4a50

View File

@ -340,59 +340,6 @@ class CMailFile
$this->smtps=$smtps;
}
// TODO not stable, in progress
else if ($this->sendmode == 'phpmailer')
{
// Use PHPMailer library
// ------------------------------------------
require_once DOL_DOCUMENT_ROOT.'/includes/phpmailer/class.phpmailer.php';
$this->phpmailer = new PHPMailer();
$this->phpmailer->CharSet = $conf->file->character_set_client;
$this->phpmailer->Subject($this->encodetorfc2822($subject));
$this->phpmailer->setTO($this->getValidAddress($to,0,1));
$this->phpmailer->SetFrom($this->getValidAddress($from,0,1));
$this->phpmailer->SetReplyTo($this->getValidAddress($replyto,0,1));
// TODO Add trackid into smtp header
// TODO if (! empty($moreinheader)) ...
if (! empty($this->html))
{
if (!empty($css))
{
$this->css = $css;
$this->buildCSS();
}
$msg = $this->html;
$msg = $this->checkIfHTML($msg);
}
if ($this->msgishtml) $smtps->setBodyContent($msg,'html');
else $smtps->setBodyContent($msg,'plain');
if ($this->atleastoneimage)
{
foreach ($this->images_encoded as $img)
{
$smtps->setImageInline($img['image_encoded'],$img['name'],$img['content_type'],$img['cid']);
}
}
if ($this->atleastonefile)
{
foreach ($filename_list as $i => $val)
{
$content=file_get_contents($filename_list[$i]);
$smtps->setAttachment($content,$mimefilename_list[$i],$mimetype_list[$i]);
}
}
$this->phpmailer->setCC($addr_cc);
$this->phpmailer->setBCC($addr_bcc);
$this->phpmailer->setErrorsTo($errors_to);
$this->phpmailer->setDeliveryReceipt($deliveryreceipt);
}
else if ($this->sendmode == 'swiftmailer')
{
// Use Swift Mailer library