mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-06 17:48:25 +01:00
Added support for SMTPS protocol
This commit is contained in:
@@ -26,6 +26,7 @@ For users:
|
|||||||
- New: Emailing feature can extract civility from contacts.
|
- New: Emailing feature can extract civility from contacts.
|
||||||
- New: Can create a third party from a member of fundation module.
|
- New: Can create a third party from a member of fundation module.
|
||||||
- New: Can set a limit for stock alert to 0.
|
- New: Can set a limit for stock alert to 0.
|
||||||
|
- New: Support SMTPS.
|
||||||
- Fix: Handle correctly the comment in status changing of supplier orders.
|
- Fix: Handle correctly the comment in status changing of supplier orders.
|
||||||
- Fix: Author, title and topic are correctly encoded in PDF.
|
- Fix: Author, title and topic are correctly encoded in PDF.
|
||||||
- Fix: Now HTML output is always UTF8, this solve bad PDF encoding on old users.
|
- Fix: Now HTML output is always UTF8, this solve bad PDF encoding on old users.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2007-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2007-2009 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
|
||||||
@@ -17,10 +17,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/admin/mails.php
|
* \file htdocs/admin/mails.php
|
||||||
\brief Page de configuration des emails
|
* \brief Page de configuration des emails
|
||||||
\version $Id$
|
* \version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require("./pre.inc.php");
|
require("./pre.inc.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
|
||||||
@@ -33,7 +33,7 @@ $langs->load("mails");
|
|||||||
if (!$user->admin)
|
if (!$user->admin)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
|
|
||||||
$substitutionarrayfortest=array(
|
$substitutionarrayfortest=array(
|
||||||
'__ID__' => 'TESTIdRecord',
|
'__ID__' => 'TESTIdRecord',
|
||||||
'__EMAIL__' => 'TESTEMail',
|
'__EMAIL__' => 'TESTEMail',
|
||||||
'__LASTNAME__' => 'TESTLastname',
|
'__LASTNAME__' => 'TESTLastname',
|
||||||
@@ -47,11 +47,14 @@ $substitutionarrayfortest=array(
|
|||||||
|
|
||||||
if (isset($_POST["action"]) && $_POST["action"] == 'update')
|
if (isset($_POST["action"]) && $_POST["action"] == 'update')
|
||||||
{
|
{
|
||||||
|
dolibarr_set_const($db, "MAIN_DISABLE_ALL_MAILS", $_POST["MAIN_DISABLE_ALL_MAILS"]);
|
||||||
|
dolibarr_set_const($db, "MAIN_MAIL_SENDMODE", $_POST["MAIN_MAIL_SENDMODE"]);
|
||||||
dolibarr_set_const($db, "MAIN_MAIL_SMTP_PORT", $_POST["MAIN_MAIL_SMTP_PORT"]);
|
dolibarr_set_const($db, "MAIN_MAIL_SMTP_PORT", $_POST["MAIN_MAIL_SMTP_PORT"]);
|
||||||
dolibarr_set_const($db, "MAIN_MAIL_SMTP_SERVER", $_POST["MAIN_MAIL_SMTP_SERVER"]);
|
dolibarr_set_const($db, "MAIN_MAIL_SMTP_SERVER", $_POST["MAIN_MAIL_SMTP_SERVER"]);
|
||||||
|
dolibarr_set_const($db, "MAIN_MAIL_SMTPS_ID", $_POST["MAIN_MAIL_SMTPS_ID"]);
|
||||||
|
dolibarr_set_const($db, "MAIN_MAIL_SMTPS_PW", $_POST["MAIN_MAIL_SMTPS_PW"]);
|
||||||
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_FROM", $_POST["MAIN_MAIL_EMAIL_FROM"]);
|
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_FROM", $_POST["MAIN_MAIL_EMAIL_FROM"]);
|
||||||
dolibarr_set_const($db, "MAIN_DISABLE_ALL_MAILS", $_POST["MAIN_DISABLE_ALL_MAILS"]);
|
|
||||||
|
|
||||||
Header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
|
Header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@@ -65,11 +68,11 @@ if ($_POST['addfile'] || $_POST['addfilehtml'])
|
|||||||
// Set tmp user directory
|
// Set tmp user directory
|
||||||
$conf->users->dir_tmp=DOL_DATA_ROOT."/users/".$user->id;
|
$conf->users->dir_tmp=DOL_DATA_ROOT."/users/".$user->id;
|
||||||
$upload_dir = $conf->users->dir_tmp.'/temp/';
|
$upload_dir = $conf->users->dir_tmp.'/temp/';
|
||||||
|
|
||||||
if (! empty($_FILES['addedfile']['tmp_name']))
|
if (! empty($_FILES['addedfile']['tmp_name']))
|
||||||
{
|
{
|
||||||
if (! is_dir($upload_dir)) create_exdir($upload_dir);
|
if (! is_dir($upload_dir)) create_exdir($upload_dir);
|
||||||
|
|
||||||
if (is_dir($upload_dir))
|
if (is_dir($upload_dir))
|
||||||
{
|
{
|
||||||
if (dol_move_uploaded_file($_FILES['addedfile']['tmp_name'], $upload_dir . "/" . $_FILES['addedfile']['name'],0) > 0)
|
if (dol_move_uploaded_file($_FILES['addedfile']['tmp_name'], $upload_dir . "/" . $_FILES['addedfile']['name'],0) > 0)
|
||||||
@@ -100,15 +103,18 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'sendhtml')
|
|||||||
&& ! $_POST['addfile'] && ! $_POST['addfilehtml'] && ! $_POST['cancel'])
|
&& ! $_POST['addfile'] && ! $_POST['addfilehtml'] && ! $_POST['cancel'])
|
||||||
{
|
{
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
$email_from='';
|
$email_from='';
|
||||||
if (! empty($_POST["fromname"])) $email_from=$_POST["fromname"].' ';
|
if (! empty($_POST["fromname"])) $email_from=$_POST["fromname"].' ';
|
||||||
if (! empty($_POST["frommail"])) $email_from.='<'.$_POST["frommail"].'>';
|
if (! empty($_POST["frommail"])) $email_from.='<'.$_POST["frommail"].'>';
|
||||||
|
|
||||||
$errors_to = $_POST["errorstomail"];
|
$errors_to = $_POST["errorstomail"];
|
||||||
$sendto = $_POST["sendto"];
|
$sendto = $_POST["sendto"];
|
||||||
|
$sendtocc = $_POST["sendtocc"];
|
||||||
|
$sendtoccc = $_POST["sendtoccc"];
|
||||||
$subject = $_POST['subject'];
|
$subject = $_POST['subject'];
|
||||||
$body = $_POST['message'];
|
$body = $_POST['message'];
|
||||||
|
$deliveryreceipt= $_POST["deliveryreceipt"];
|
||||||
|
|
||||||
// Create form object
|
// Create form object
|
||||||
include_once('../html.formmail.class.php');
|
include_once('../html.formmail.class.php');
|
||||||
@@ -118,7 +124,7 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'sendhtml')
|
|||||||
$filepath = $attachedfiles['paths'];
|
$filepath = $attachedfiles['paths'];
|
||||||
$filename = $attachedfiles['names'];
|
$filename = $attachedfiles['names'];
|
||||||
$mimetype = $attachedfiles['mimes'];
|
$mimetype = $attachedfiles['mimes'];
|
||||||
|
|
||||||
if (empty($_POST["frommail"]))
|
if (empty($_POST["frommail"]))
|
||||||
{
|
{
|
||||||
$message='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("MailFrom")).'</div>';
|
$message='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("MailFrom")).'</div>';
|
||||||
@@ -135,18 +141,19 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'sendhtml')
|
|||||||
{
|
{
|
||||||
// Le message est-il en html
|
// Le message est-il en html
|
||||||
$msgishtml=0; // Message is not HTML
|
$msgishtml=0; // Message is not HTML
|
||||||
if ($_POST['action'] == 'sendhtml') $msgishtml=1; // Force message to HTML
|
if ($_POST['action'] == 'sendhtml') $msgishtml=1; // Force message to HTML
|
||||||
|
|
||||||
// Pratique les substitutions sur le sujet et message
|
// Pratique les substitutions sur le sujet et message
|
||||||
$subject=make_substitutions($subject,$substitutionarrayfortest);
|
$subject=make_substitutions($subject,$substitutionarrayfortest);
|
||||||
$body=make_substitutions($body,$substitutionarrayfortest);
|
$body=make_substitutions($body,$substitutionarrayfortest);
|
||||||
|
|
||||||
require_once(DOL_DOCUMENT_ROOT."/lib/CMailFile.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/lib/CMailFile.class.php");
|
||||||
$mailfile = new CMailFile($subject,$sendto,$email_from,$body,
|
$mailfile = new CMailFile($subject,$sendto,$email_from,$body,
|
||||||
$filepath,$mimetype,$filename,
|
$filepath,$mimetype,$filename,
|
||||||
'', '', 0, $msgishtml,$errors_to);
|
$sendtocc, $sendtoccc, $deliveryreceipt, $msgishtml,$errors_to);
|
||||||
|
|
||||||
$result=$mailfile->sendfile();
|
$result=$mailfile->sendfile();
|
||||||
|
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
$message='<div class="ok">'.$langs->trans("MailSuccessfulySent",$email_from,$sendto).'</div>';
|
$message='<div class="ok">'.$langs->trans("MailSuccessfulySent",$email_from,$sendto).'</div>';
|
||||||
@@ -171,6 +178,7 @@ if (eregi('^win',PHP_OS)) $linuxlike=0;
|
|||||||
if (eregi('^mac',PHP_OS)) $linuxlike=0;
|
if (eregi('^mac',PHP_OS)) $linuxlike=0;
|
||||||
|
|
||||||
|
|
||||||
|
if (empty($conf->global->MAIN_MAIL_SENDMODE)) $conf->global->MAIN_MAIL_SENDMODE='mail';
|
||||||
$port=! empty($conf->global->MAIN_MAIL_SMTP_PORT)?$conf->global->MAIN_MAIL_SMTP_PORT:ini_get('smtp_port');
|
$port=! empty($conf->global->MAIN_MAIL_SMTP_PORT)?$conf->global->MAIN_MAIL_SMTP_PORT:ini_get('smtp_port');
|
||||||
if (! $port) $port=25;
|
if (! $port) $port=25;
|
||||||
$server=! empty($conf->global->MAIN_MAIL_SMTP_SERVER)?$conf->global->MAIN_MAIL_SMTP_SERVER:ini_get('SMTP');
|
$server=! empty($conf->global->MAIN_MAIL_SMTP_SERVER)?$conf->global->MAIN_MAIL_SMTP_SERVER:ini_get('SMTP');
|
||||||
@@ -204,6 +212,22 @@ if (isset($_GET["action"]) && $_GET["action"] == 'edit')
|
|||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||||
|
|
||||||
|
// Disable
|
||||||
|
$var=!$var;
|
||||||
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_DISABLE_ALL_MAILS").'</td><td>';
|
||||||
|
print $html->selectyesno('MAIN_DISABLE_ALL_MAILS',$conf->global->MAIN_DISABLE_ALL_MAILS,1);
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Method
|
||||||
|
$var=!$var;
|
||||||
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_SENDMODE").'</td><td>';
|
||||||
|
$listofmethods=array();
|
||||||
|
$listofmethods['mail']='PHP mail function';
|
||||||
|
if ($conf->global->MAIN_FEATURES_LEVEL > 0) $listofmethods['smtps']='SMTPS library ('.$langs->trans("Experimental").')';
|
||||||
|
print $html->select_array('MAIN_MAIL_SENDMODE',$listofmethods,$conf->global->MAIN_MAIL_SENDMODE);
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Server
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
if ($linuxlike)
|
if ($linuxlike)
|
||||||
{
|
{
|
||||||
@@ -213,7 +237,8 @@ if (isset($_GET["action"]) && $_GET["action"] == 'edit')
|
|||||||
{
|
{
|
||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_SMTP_SERVER",ini_get('SMTP')?ini_get('SMTP'):$langs->transnoentities("Undefined")).'</td><td><input class="flat" name="MAIN_MAIL_SMTP_SERVER" size="18" value="' . $conf->global->MAIN_MAIL_SMTP_SERVER . '"></td></tr>';
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_SMTP_SERVER",ini_get('SMTP')?ini_get('SMTP'):$langs->transnoentities("Undefined")).'</td><td><input class="flat" name="MAIN_MAIL_SMTP_SERVER" size="18" value="' . $conf->global->MAIN_MAIL_SMTP_SERVER . '"></td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Port
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
if ($linuxlike)
|
if ($linuxlike)
|
||||||
{
|
{
|
||||||
@@ -223,15 +248,25 @@ if (isset($_GET["action"]) && $_GET["action"] == 'edit')
|
|||||||
{
|
{
|
||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_SMTP_PORT",ini_get('smtp_port')?ini_get('smtp_port'):$langs->transnoentities("Undefined")).'</td><td><input class="flat" name="MAIN_MAIL_SMTP_PORT" size="3" value="' . $conf->global->MAIN_MAIL_SMTP_PORT . '"></td></tr>';
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_SMTP_PORT",ini_get('smtp_port')?ini_get('smtp_port'):$langs->transnoentities("Undefined")).'</td><td><input class="flat" name="MAIN_MAIL_SMTP_PORT" size="3" value="' . $conf->global->MAIN_MAIL_SMTP_PORT . '"></td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ID
|
||||||
|
if ($conf->global->MAIN_MAIL_SENDMODE == 'smtps')
|
||||||
|
{
|
||||||
|
$var=!$var;
|
||||||
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_SMTPS_ID").'</td><td><input class="flat" name="MAIN_MAIL_SMTPS_ID" size="32" value="' . $conf->global->MAIN_MAIL_SMTPS_ID . '"></td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// PW
|
||||||
|
if ($conf->global->MAIN_MAIL_SENDMODE == 'smtps')
|
||||||
|
{
|
||||||
|
$var=!$var;
|
||||||
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_SMTPS_PW").'</td><td><input class="flat" name="MAIN_MAIL_SMTPS_PW" size="32" value="' . $conf->global->MAIN_MAIL_SMTPS_PW . '"></td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// From
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_EMAIL_FROM",ini_get('sendmail_from')?ini_get('sendmail_from'):$langs->transnoentities("Undefined")).'</td><td><input class="flat" name="MAIN_MAIL_EMAIL_FROM" size="32" value="' . $conf->global->MAIN_MAIL_EMAIL_FROM . '"></td></tr>';
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_EMAIL_FROM",ini_get('sendmail_from')?ini_get('sendmail_from'):$langs->transnoentities("Undefined")).'</td><td><input class="flat" name="MAIN_MAIL_EMAIL_FROM" size="32" value="' . $conf->global->MAIN_MAIL_EMAIL_FROM . '"></td></tr>';
|
||||||
|
|
||||||
$var=!$var;
|
|
||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_DISABLE_ALL_MAILS").'</td><td>';
|
|
||||||
print $html->selectyesno('MAIN_DISABLE_ALL_MAILS',$conf->global->MAIN_DISABLE_ALL_MAILS,1);
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print '<br><center>';
|
print '<br><center>';
|
||||||
@@ -248,8 +283,21 @@ else
|
|||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||||
|
|
||||||
|
// Disable
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
if ($linuxlike)
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_DISABLE_ALL_MAILS").'</td><td>'.yn($conf->global->MAIN_DISABLE_ALL_MAILS).'</td></tr>';
|
||||||
|
|
||||||
|
// Method
|
||||||
|
$var=!$var;
|
||||||
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_SENDMODE").'</td><td>';
|
||||||
|
if ($conf->global->MAIN_MAIL_SENDMODE == 'mail') print 'PHP mail function';
|
||||||
|
elseif ($conf->global->MAIN_MAIL_SENDMODE == 'smtps') print 'SMTPS library';
|
||||||
|
else { print $langs->trans("Undefined"); }
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Server
|
||||||
|
$var=!$var;
|
||||||
|
if ($linuxlike && $conf->global->MAIN_MAIL_SENDMODE == 'mail')
|
||||||
{
|
{
|
||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike").'</td><td>'.$langs->trans("SeeLocalSendMailSetup").'</td></tr>';
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike").'</td><td>'.$langs->trans("SeeLocalSendMailSetup").'</td></tr>';
|
||||||
}
|
}
|
||||||
@@ -257,9 +305,10 @@ else
|
|||||||
{
|
{
|
||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_SMTP_SERVER",ini_get('SMTP')?ini_get('SMTP'):$langs->transnoentities("Undefined")).'</td><td>'.$conf->global->MAIN_MAIL_SMTP_SERVER.'</td></tr>';
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_SMTP_SERVER",ini_get('SMTP')?ini_get('SMTP'):$langs->transnoentities("Undefined")).'</td><td>'.$conf->global->MAIN_MAIL_SMTP_SERVER.'</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Port
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
if ($linuxlike)
|
if ($linuxlike && $conf->global->MAIN_MAIL_SENDMODE == 'mail')
|
||||||
{
|
{
|
||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike").'</td><td>'.$langs->trans("SeeLocalSendMailSetup").'</td></tr>';
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike").'</td><td>'.$langs->trans("SeeLocalSendMailSetup").'</td></tr>';
|
||||||
}
|
}
|
||||||
@@ -267,16 +316,25 @@ else
|
|||||||
{
|
{
|
||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_SMTP_PORT",ini_get('smtp_port')?ini_get('smtp_port'):$langs->transnoentities("Undefined")).'</td><td>'.$conf->global->MAIN_MAIL_SMTP_PORT.'</td></tr>';
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_SMTP_PORT",ini_get('smtp_port')?ini_get('smtp_port'):$langs->transnoentities("Undefined")).'</td><td>'.$conf->global->MAIN_MAIL_SMTP_PORT.'</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// $var=!$var;
|
|
||||||
// print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_SMTPS_SERVER",ini_get('SMTPs')?ini_get('SMTPs'):$langs->transnoentities("Undefined")).'</td><td>'.$conf->global->MAIN_MAIL_SMTPS_SERVER.'</td></tr>';
|
|
||||||
|
|
||||||
|
// SMTPS ID
|
||||||
|
$var=!$var;
|
||||||
|
if ($conf->global->MAIN_MAIL_SENDMODE == 'smtps')
|
||||||
|
{
|
||||||
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_SMTPS_ID").'</td><td>'.$conf->global->MAIN_MAIL_SMTPS_ID.'</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// SMTPS PW
|
||||||
|
$var=!$var;
|
||||||
|
if ($conf->global->MAIN_MAIL_SENDMODE == 'smtps')
|
||||||
|
{
|
||||||
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_SMTPS_PW").'</td><td>'.$conf->global->MAIN_MAIL_SMTPS_PW.'</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// From
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_EMAIL_FROM",ini_get('sendmail_from')?ini_get('sendmail_from'):$langs->transnoentities("Undefined")).'</td><td>'.$conf->global->MAIN_MAIL_EMAIL_FROM.'</td></tr>';
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_EMAIL_FROM",ini_get('sendmail_from')?ini_get('sendmail_from'):$langs->transnoentities("Undefined")).'</td><td>'.$conf->global->MAIN_MAIL_EMAIL_FROM.'</td></tr>';
|
||||||
|
|
||||||
$var=!$var;
|
|
||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_DISABLE_ALL_MAILS").'</td><td>'.yn($conf->global->MAIN_DISABLE_ALL_MAILS).'</td></tr>';
|
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
|
|
||||||
@@ -300,23 +358,23 @@ else
|
|||||||
}
|
}
|
||||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>';
|
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
|
|
||||||
// Affichage formulaire de TEST
|
// Affichage formulaire de TEST
|
||||||
if ($_GET["action"] == 'testconnect')
|
if ($_GET["action"] == 'testconnect')
|
||||||
{
|
{
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print_titre($langs->trans("DoTestServerAvailability"));
|
print_titre($langs->trans("DoTestServerAvailability"));
|
||||||
|
|
||||||
// Cree l'objet formulaire mail
|
// Cree l'objet formulaire mail
|
||||||
include_once(DOL_DOCUMENT_ROOT."/lib/CMailFile.class.php");
|
include_once(DOL_DOCUMENT_ROOT."/lib/CMailFile.class.php");
|
||||||
$mail = new CMailFile('','','','');
|
$mail = new CMailFile('','','','');
|
||||||
$result=$mail->check_server_port($server,$port);
|
$result=$mail->check_server_port($server,$port);
|
||||||
if ($result) print '<div class="ok">'.$langs->trans("ServerAvailableOnIPOrPort",$server,$port).'</div>';
|
if ($result) print '<div class="ok">'.$langs->trans("ServerAvailableOnIPOrPort",$server,$port).'</div>';
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<div class="error">'.$langs->trans("ServerNotAvailableOnIPOrPort",$server,$port);
|
print '<div class="error">'.$langs->trans("ServerNotAvailableOnIPOrPort",$server,$port);
|
||||||
if ($mail->error) print ' - '.$mail->error;
|
if ($mail->error) print ' - '.$langs->convToOutputCharset($mail->error,'ISO-8859-1');
|
||||||
print '</div>';
|
print '</div>';
|
||||||
}
|
}
|
||||||
print '<br>';
|
print '<br>';
|
||||||
@@ -324,28 +382,30 @@ else
|
|||||||
|
|
||||||
// Affichage formulaire de TEST simple
|
// Affichage formulaire de TEST simple
|
||||||
if ($_GET["action"] == 'test')
|
if ($_GET["action"] == 'test')
|
||||||
{
|
{
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print_titre($langs->trans("DoTestSend"));
|
print_titre($langs->trans("DoTestSend"));
|
||||||
|
|
||||||
// Cree l'objet formulaire mail
|
// Cree l'objet formulaire mail
|
||||||
include_once(DOL_DOCUMENT_ROOT."/html.formmail.class.php");
|
include_once(DOL_DOCUMENT_ROOT."/html.formmail.class.php");
|
||||||
$formmail = new FormMail($db);
|
$formmail = new FormMail($db);
|
||||||
$formmail->fromname = $conf->global->MAIN_MAIL_EMAIL_FROM;
|
$formmail->fromname = (isset($_POST['fromname'])?$_POST['fromname']:$conf->global->MAIN_MAIL_EMAIL_FROM);
|
||||||
$formmail->frommail = $conf->global->MAIN_MAIL_EMAIL_FROM;
|
$formmail->frommail = (isset($_POST['frommail'])?$_POST['frommail']:$conf->global->MAIN_MAIL_EMAIL_FROM);
|
||||||
$formmail->withfromreadonly=0;
|
$formmail->withfromreadonly=0;
|
||||||
$formmail->withsubstit=0;
|
$formmail->withsubstit=0;
|
||||||
$formmail->withfrom=1;
|
$formmail->withfrom=1;
|
||||||
$formmail->witherrorsto=1;
|
$formmail->witherrorsto=1;
|
||||||
$formmail->withto=$user->email?$user->email:1;
|
$formmail->withto=(isset($_POST['sendto'])?$_POST['sendto']:$user->email?$user->email:1);
|
||||||
$formmail->withtocc=1;
|
$formmail->withtocc=(isset($_POST['sendtocc'])?$_POST['sendtocc']:1);
|
||||||
$formmail->withtopic=$langs->trans("Test");
|
$formmail->withtoccc=(isset($_POST['sendtoccc'])?$_POST['sendtoccc']:1);
|
||||||
|
$formmail->withtopic=(isset($_POST['subject'])?$_POST['subject']:$langs->trans("Test"));
|
||||||
$formmail->withtopicreadonly=0;
|
$formmail->withtopicreadonly=0;
|
||||||
$formmail->withfile=2;
|
$formmail->withfile=2;
|
||||||
$formmail->withbody=$langs->trans("Test");
|
$formmail->withbody=(isset($_POST['message'])?$_POST['message']:$langs->trans("Test"));
|
||||||
$formmail->withbodyreadonly=0;
|
$formmail->withbodyreadonly=0;
|
||||||
$formmail->withcancel=1;
|
$formmail->withcancel=1;
|
||||||
$formmail->withdeliveryreceipt=1;
|
$formmail->withdeliveryreceipt=1;
|
||||||
|
$formmail->withfckeditor=0;
|
||||||
// Tableau des substitutions
|
// Tableau des substitutions
|
||||||
$formmail->substit=$substitutionarrayfortest;
|
$formmail->substit=$substitutionarrayfortest;
|
||||||
// Tableau des parametres complementaires du post
|
// Tableau des parametres complementaires du post
|
||||||
@@ -353,39 +413,40 @@ else
|
|||||||
$formmail->param["models"]="body";
|
$formmail->param["models"]="body";
|
||||||
$formmail->param["mailid"]=$mil->id;
|
$formmail->param["mailid"]=$mil->id;
|
||||||
$formmail->param["returnurl"]=DOL_URL_ROOT."/admin/mails.php";
|
$formmail->param["returnurl"]=DOL_URL_ROOT."/admin/mails.php";
|
||||||
|
|
||||||
// Init list of files
|
// Init list of files
|
||||||
if (! empty($_REQUEST["mode"]) && $_REQUEST["mode"]=='init')
|
if (! empty($_REQUEST["mode"]) && $_REQUEST["mode"]=='init')
|
||||||
{
|
{
|
||||||
$formmail->clear_attached_files();
|
$formmail->clear_attached_files();
|
||||||
}
|
}
|
||||||
|
|
||||||
$formmail->show_form('addfile');
|
$formmail->show_form('addfile');
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Affichage formulaire de TEST HTML
|
// Affichage formulaire de TEST HTML
|
||||||
if ($_GET["action"] == 'testhtml')
|
if ($_GET["action"] == 'testhtml')
|
||||||
{
|
{
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print_titre($langs->trans("DoTestSendHTML"));
|
print_titre($langs->trans("DoTestSendHTML"));
|
||||||
|
|
||||||
// Cree l'objet formulaire mail
|
// Cree l'objet formulaire mail
|
||||||
include_once(DOL_DOCUMENT_ROOT."/html.formmail.class.php");
|
include_once(DOL_DOCUMENT_ROOT."/html.formmail.class.php");
|
||||||
$formmail = new FormMail($db);
|
$formmail = new FormMail($db);
|
||||||
$formmail->fromname = $conf->global->MAIN_MAIL_EMAIL_FROM;
|
$formmail->fromname = $conf->global->MAIN_MAIL_EMAIL_FROM;
|
||||||
$formmail->frommail = $conf->global->MAIN_MAIL_EMAIL_FROM;
|
$formmail->frommail = $conf->global->MAIN_MAIL_EMAIL_FROM;
|
||||||
$formmail->withfromreadonly=0;
|
$formmail->withfromreadonly=0;
|
||||||
$formmail->withsubstit=0;
|
$formmail->withsubstit=0;
|
||||||
$formmail->withfrom=1;
|
$formmail->withfrom=1;
|
||||||
$formmail->witherrorsto=1;
|
$formmail->witherrorsto=1;
|
||||||
$formmail->withto=$user->email?$user->email:1;
|
$formmail->withto=(isset($_POST['sendto'])?$_POST['sendto']:$user->email?$user->email:1);
|
||||||
$formmail->withtocc=1;
|
$formmail->withtocc=(isset($_POST['sendtocc'])?$_POST['sendtocc']:1);
|
||||||
$formmail->withtopic=$langs->trans("Test");
|
$formmail->withtoccc=(isset($_POST['sendtoccc'])?$_POST['sendtoccc']:1);
|
||||||
|
$formmail->withtopic=(isset($_POST['subject'])?$_POST['subject']:$langs->trans("Test"));
|
||||||
$formmail->withtopicreadonly=0;
|
$formmail->withtopicreadonly=0;
|
||||||
$formmail->withfile=2;
|
$formmail->withfile=2;
|
||||||
$formmail->withbody=$langs->trans("Test");
|
$formmail->withbody=(isset($_POST['message'])?$_POST['message']:$langs->trans("Test"));
|
||||||
$formmail->withbodyreadonly=0;
|
$formmail->withbodyreadonly=0;
|
||||||
$formmail->withcancel=1;
|
$formmail->withcancel=1;
|
||||||
$formmail->withdeliveryreceipt=1;
|
$formmail->withdeliveryreceipt=1;
|
||||||
@@ -397,15 +458,15 @@ else
|
|||||||
$formmail->param["models"]="body";
|
$formmail->param["models"]="body";
|
||||||
$formmail->param["mailid"]=$mil->id;
|
$formmail->param["mailid"]=$mil->id;
|
||||||
$formmail->param["returnurl"]=DOL_URL_ROOT."/admin/mails.php";
|
$formmail->param["returnurl"]=DOL_URL_ROOT."/admin/mails.php";
|
||||||
|
|
||||||
// Init list of files
|
// Init list of files
|
||||||
if (! empty($_REQUEST["mode"]) && $_REQUEST["mode"]=='init')
|
if (! empty($_REQUEST["mode"]) && $_REQUEST["mode"]=='init')
|
||||||
{
|
{
|
||||||
$formmail->clear_attached_files();
|
$formmail->clear_attached_files();
|
||||||
}
|
}
|
||||||
|
|
||||||
$formmail->show_form('addfilehtml');
|
$formmail->show_form('addfilehtml');
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,14 +63,14 @@ class Form
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Affiche un texte+picto avec tooltip sur texte ou sur picto
|
* \brief Affiche un texte+picto avec tooltip sur texte ou sur picto
|
||||||
\param text Texte <20> afficher
|
* \param text Texte <20> afficher
|
||||||
\param htmltext Contenu html du tooltip, cod<6F> en html
|
* \param htmltext Contenu html du tooltip, cod<6F> en html
|
||||||
\param tooltipon 1=tooltip sur texte, 2=tooltip sur picto, 3=tooltip sur les 2, 4=tooltip sur les 2 et forc<72> en Ajax
|
* \param tooltipon 1=tooltip sur texte, 2=tooltip sur picto, 3=tooltip sur les 2, 4=tooltip sur les 2 et forc<72> en Ajax
|
||||||
\param direction -1=Le picto est avant, 0=pas de picto, 1=le picto est apr<70>s
|
* \param direction -1=Le picto est avant, 0=pas de picto, 1=le picto est apr<70>s
|
||||||
\param img Code img du picto
|
* \param img Code img du picto
|
||||||
\return string Code html du tooltip (texte+picto)
|
* \return string Code html du tooltip (texte+picto)
|
||||||
*/
|
*/
|
||||||
function textwithtooltip($text,$htmltext,$tooltipon=1,$direction=0,$img='',$i=1,$width='200',$shiftX='10')
|
function textwithtooltip($text,$htmltext,$tooltipon=1,$direction=0,$img='',$i=1,$width='200',$shiftX='10')
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|||||||
@@ -34,14 +34,14 @@ require_once(DOL_DOCUMENT_ROOT ."/html.form.class.php");
|
|||||||
class FormMail
|
class FormMail
|
||||||
{
|
{
|
||||||
var $db;
|
var $db;
|
||||||
|
|
||||||
var $fromname;
|
var $fromname;
|
||||||
var $frommail;
|
var $frommail;
|
||||||
var $replytoname;
|
var $replytoname;
|
||||||
var $replytomail;
|
var $replytomail;
|
||||||
var $toname;
|
var $toname;
|
||||||
var $tomail;
|
var $tomail;
|
||||||
|
|
||||||
var $withsubstit; // Show substitution array
|
var $withsubstit; // Show substitution array
|
||||||
var $withfrom;
|
var $withfrom;
|
||||||
var $withto;
|
var $withto;
|
||||||
@@ -49,7 +49,7 @@ class FormMail
|
|||||||
var $withtopic;
|
var $withtopic;
|
||||||
var $withfile; // 0=No attaches files, 1=Show attached files, 2=Can add new attached files
|
var $withfile; // 0=No attaches files, 1=Show attached files, 2=Can add new attached files
|
||||||
var $withbody;
|
var $withbody;
|
||||||
|
|
||||||
var $withfromreadonly;
|
var $withfromreadonly;
|
||||||
var $withreplytoreadonly;
|
var $withreplytoreadonly;
|
||||||
var $withtoreadonly;
|
var $withtoreadonly;
|
||||||
@@ -57,13 +57,13 @@ class FormMail
|
|||||||
var $withtopicreadonly;
|
var $withtopicreadonly;
|
||||||
var $withdeliveryreceipt;
|
var $withdeliveryreceipt;
|
||||||
var $withcancel;
|
var $withcancel;
|
||||||
|
|
||||||
var $substit=array();
|
var $substit=array();
|
||||||
var $param=array();
|
var $param=array();
|
||||||
|
|
||||||
var $error;
|
var $error;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Constructeur
|
\brief Constructeur
|
||||||
\param DB handler d'acc<63>s base de donn<6E>e
|
\param DB handler d'acc<63>s base de donn<6E>e
|
||||||
@@ -71,7 +71,7 @@ class FormMail
|
|||||||
function FormMail($DB)
|
function FormMail($DB)
|
||||||
{
|
{
|
||||||
$this->db = $DB;
|
$this->db = $DB;
|
||||||
|
|
||||||
$this->withfrom=1;
|
$this->withfrom=1;
|
||||||
$this->withto=1;
|
$this->withto=1;
|
||||||
$this->withtocc=1;
|
$this->withtocc=1;
|
||||||
@@ -80,7 +80,7 @@ class FormMail
|
|||||||
$this->withtopic=1;
|
$this->withtopic=1;
|
||||||
$this->withfile=0;
|
$this->withfile=0;
|
||||||
$this->withbody=1;
|
$this->withbody=1;
|
||||||
|
|
||||||
$this->withfromreadonly=1;
|
$this->withfromreadonly=1;
|
||||||
$this->withreplytoreadonly=1;
|
$this->withreplytoreadonly=1;
|
||||||
$this->withtoreadonly=0;
|
$this->withtoreadonly=0;
|
||||||
@@ -89,7 +89,7 @@ class FormMail
|
|||||||
$this->withtopicreadonly=0;
|
$this->withtopicreadonly=0;
|
||||||
$this->withbodyreadonly=0;
|
$this->withbodyreadonly=0;
|
||||||
$this->withdeliveryreceiptreadonly=0;
|
$this->withdeliveryreceiptreadonly=0;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,18 +97,18 @@ class FormMail
|
|||||||
* Clear list of attached files in send mail form (stored in session)
|
* Clear list of attached files in send mail form (stored in session)
|
||||||
*/
|
*/
|
||||||
function clear_attached_files()
|
function clear_attached_files()
|
||||||
{
|
{
|
||||||
global $conf,$user;
|
global $conf,$user;
|
||||||
|
|
||||||
$conf->users->dir_tmp=DOL_DATA_ROOT."/users/".$user->id;
|
$conf->users->dir_tmp=DOL_DATA_ROOT."/users/".$user->id;
|
||||||
$upload_dir = $conf->users->dir_tmp.'/temp';
|
$upload_dir = $conf->users->dir_tmp.'/temp';
|
||||||
if (is_dir($upload_dir)) dol_delete_dir_recursive($upload_dir);
|
if (is_dir($upload_dir)) dol_delete_dir_recursive($upload_dir);
|
||||||
|
|
||||||
unset($_SESSION["listofpaths"]);
|
unset($_SESSION["listofpaths"]);
|
||||||
unset($_SESSION["listofnames"]);
|
unset($_SESSION["listofnames"]);
|
||||||
unset($_SESSION["listofmimes"]);
|
unset($_SESSION["listofmimes"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a file into the list of attached files (stored in SECTION array)
|
* Add a file into the list of attached files (stored in SECTION array)
|
||||||
*
|
*
|
||||||
@@ -150,30 +150,30 @@ class FormMail
|
|||||||
if (! empty($_SESSION["listofmimes"])) $listofmimes=split(';',$_SESSION["listofmimes"]);
|
if (! empty($_SESSION["listofmimes"])) $listofmimes=split(';',$_SESSION["listofmimes"]);
|
||||||
return array('paths'=>$listofpaths, 'names'=>$listofnames, 'mimes'=>$listofmimes);
|
return array('paths'=>$listofpaths, 'names'=>$listofnames, 'mimes'=>$listofmimes);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Affiche la partie de formulaire pour saisie d'un mail en fonction des propri<72>t<EFBFBD>s
|
* \brief Affiche la partie de formulaire pour saisie d'un mail en fonction des propri<72>t<EFBFBD>s
|
||||||
* \param addfileaction Name of action when posting file attachments
|
* \param addfileaction Name of action when posting file attachments
|
||||||
* \remarks this->withfile: 0=No attaches files, 1=Show attached files, 2=Can add new attached files
|
* \remarks this->withfile: 0=No attaches files, 1=Show attached files, 2=Can add new attached files
|
||||||
*/
|
*/
|
||||||
function show_form($addfileaction='addfile')
|
function show_form($addfileaction='addfile')
|
||||||
{
|
{
|
||||||
global $conf, $langs, $user;
|
global $conf, $langs, $user;
|
||||||
|
|
||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
$langs->load("mails");
|
$langs->load("mails");
|
||||||
|
|
||||||
// Define list of attached files
|
// Define list of attached files
|
||||||
$listofpaths=array();
|
$listofpaths=array();
|
||||||
$listofnames=array();
|
$listofnames=array();
|
||||||
$listofmimes=array();
|
$listofmimes=array();
|
||||||
if (! empty($_SESSION["listofpaths"])) $listofpaths=split(';',$_SESSION["listofpaths"]);
|
if (! empty($_SESSION["listofpaths"])) $listofpaths=split(';',$_SESSION["listofpaths"]);
|
||||||
if (! empty($_SESSION["listofnames"])) $listofnames=split(';',$_SESSION["listofnames"]);
|
if (! empty($_SESSION["listofnames"])) $listofnames=split(';',$_SESSION["listofnames"]);
|
||||||
if (! empty($_SESSION["listofmimes"])) $listofmimes=split(';',$_SESSION["listofmimes"]);
|
if (! empty($_SESSION["listofmimes"])) $listofmimes=split(';',$_SESSION["listofmimes"]);
|
||||||
|
|
||||||
|
|
||||||
$form=new Form($DB);
|
$form=new Form($DB);
|
||||||
|
|
||||||
print "\n<!-- Debut form mail -->\n";
|
print "\n<!-- Debut form mail -->\n";
|
||||||
print "<form method=\"post\" ENCTYPE=\"multipart/form-data\" action=\"".$this->param["returnurl"]."\">\n";
|
print "<form method=\"post\" ENCTYPE=\"multipart/form-data\" action=\"".$this->param["returnurl"]."\">\n";
|
||||||
foreach ($this->param as $key=>$value)
|
foreach ($this->param as $key=>$value)
|
||||||
@@ -181,7 +181,7 @@ class FormMail
|
|||||||
print "<input type=\"hidden\" name=\"$key\" value=\"$value\">\n";
|
print "<input type=\"hidden\" name=\"$key\" value=\"$value\">\n";
|
||||||
}
|
}
|
||||||
print "<table class=\"border\" width=\"100%\">\n";
|
print "<table class=\"border\" width=\"100%\">\n";
|
||||||
|
|
||||||
// Substitution array
|
// Substitution array
|
||||||
if ($this->withsubstit)
|
if ($this->withsubstit)
|
||||||
{
|
{
|
||||||
@@ -194,7 +194,7 @@ class FormMail
|
|||||||
print $form->textwithhelp($langs->trans("EMailTestSubstitutionReplacedByGenericValues"),$help);
|
print $form->textwithhelp($langs->trans("EMailTestSubstitutionReplacedByGenericValues"),$help);
|
||||||
print "</td></tr>\n";
|
print "</td></tr>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// From
|
// From
|
||||||
if ($this->withfrom)
|
if ($this->withfrom)
|
||||||
{
|
{
|
||||||
@@ -211,7 +211,7 @@ class FormMail
|
|||||||
$fuser->fetch();
|
$fuser->fetch();
|
||||||
print $fuser->getNomUrl(1);
|
print $fuser->getNomUrl(1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print $this->fromname;
|
print $this->fromname;
|
||||||
}
|
}
|
||||||
@@ -239,7 +239,7 @@ class FormMail
|
|||||||
print "</td></tr>\n";
|
print "</td></tr>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Replyto
|
// Replyto
|
||||||
if ($this->withreplyto)
|
if ($this->withreplyto)
|
||||||
{
|
{
|
||||||
@@ -270,18 +270,20 @@ class FormMail
|
|||||||
print "</td></tr>\n";
|
print "</td></tr>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// To
|
// To
|
||||||
if ($this->withto || is_array($this->withto))
|
if ($this->withto || is_array($this->withto))
|
||||||
{
|
{
|
||||||
print '<tr><td width="180">'.$langs->trans("MailTo").'</td><td>';
|
print '<tr><td width="180">';
|
||||||
|
print $form->textwithhelp($langs->trans("MailTo"),$langs->trans("YouCanUseCommaSeparatorForSeveralRecipients"));
|
||||||
|
print '</td><td>';
|
||||||
if ($this->withtoreadonly)
|
if ($this->withtoreadonly)
|
||||||
{
|
{
|
||||||
print (! is_array($this->withto) && ! is_numeric($this->withto))?$this->withto:"";
|
print (! is_array($this->withto) && ! is_numeric($this->withto))?$this->withto:"";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print "<input size=\"30\" name=\"sendto\" value=\"".(! is_array($this->withto) && ! is_numeric($this->withto)?$this->withto:"")."\">";
|
print "<input size=\"".(is_array($this->withto)?"30":"60")."\" name=\"sendto\" value=\"".(! is_array($this->withto) && ! is_numeric($this->withto)?$this->withto:"")."\">";
|
||||||
if (is_array($this->withto))
|
if (is_array($this->withto))
|
||||||
{
|
{
|
||||||
print " ".$langs->trans("or")." ";
|
print " ".$langs->trans("or")." ";
|
||||||
@@ -290,18 +292,20 @@ class FormMail
|
|||||||
}
|
}
|
||||||
print "</td></tr>\n";
|
print "</td></tr>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// CC
|
// CC
|
||||||
if ($this->withtocc || is_array($this->withtocc))
|
if ($this->withtocc || is_array($this->withtocc))
|
||||||
{
|
{
|
||||||
print '<tr><td width="180">'.$langs->trans("MailCC").'</td><td>';
|
print '<tr><td width="180">';
|
||||||
|
print $form->textwithhelp($langs->trans("MailCC"),$langs->trans("YouCanUseCommaSeparatorForSeveralRecipients"));
|
||||||
|
print '</td><td>';
|
||||||
if ($this->withtoccreadonly)
|
if ($this->withtoccreadonly)
|
||||||
{
|
{
|
||||||
print (! is_array($this->withtocc) && ! is_numeric($this->withtocc))?$this->withtocc:"";
|
print (! is_array($this->withtocc) && ! is_numeric($this->withtocc))?$this->withtocc:"";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print "<input size=\"30\" name=\"sendtocc\" value=\"".((! is_array($this->withtocc) && ! is_numeric($this->withtocc))?$this->withtocc:"")."\">";
|
print "<input size=\"".(is_array($this->withtocc)?"30":"60")."\" name=\"sendtocc\" value=\"".((! is_array($this->withtocc) && ! is_numeric($this->withtocc))?$this->withtocc:"")."\">";
|
||||||
if (is_array($this->withtocc))
|
if (is_array($this->withtocc))
|
||||||
{
|
{
|
||||||
print " ".$langs->trans("or")." ";
|
print " ".$langs->trans("or")." ";
|
||||||
@@ -314,14 +318,16 @@ class FormMail
|
|||||||
// CCC
|
// CCC
|
||||||
if ($this->withtoccc || is_array($this->withtoccc))
|
if ($this->withtoccc || is_array($this->withtoccc))
|
||||||
{
|
{
|
||||||
print '<tr><td width="180">'.$langs->trans("MailCCC").'</td><td>';
|
print '<tr><td width="180">';
|
||||||
|
print $form->textwithhelp($langs->trans("MailCCC"),$langs->trans("YouCanUseCommaSeparatorForSeveralRecipients"));
|
||||||
|
print '</td><td>';
|
||||||
if ($this->withtocccreadonly)
|
if ($this->withtocccreadonly)
|
||||||
{
|
{
|
||||||
print (! is_array($this->withtoccc) && ! is_numeric($this->withtoccc))?$this->withtoccc:"";
|
print (! is_array($this->withtoccc) && ! is_numeric($this->withtoccc))?$this->withtoccc:"";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print "<input size=\"30\" name=\"sendtocc\" value=\"".((! is_array($this->withtoccc) && ! is_numeric($this->withtoccc))?$this->withtoccc:"")."\">";
|
print "<input size=\"".(is_array($this->withtoccc)?"30":"60")."\" name=\"sendtoccc\" value=\"".((! is_array($this->withtoccc) && ! is_numeric($this->withtoccc))?$this->withtoccc:"")."\">";
|
||||||
if (is_array($this->withtoccc))
|
if (is_array($this->withtoccc))
|
||||||
{
|
{
|
||||||
print " ".$langs->trans("or")." ";
|
print " ".$langs->trans("or")." ";
|
||||||
@@ -330,7 +336,7 @@ class FormMail
|
|||||||
}
|
}
|
||||||
print "</td></tr>\n";
|
print "</td></tr>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ask delivery receipt
|
// Ask delivery receipt
|
||||||
if ($this->withdeliveryreceipt)
|
if ($this->withdeliveryreceipt)
|
||||||
{
|
{
|
||||||
@@ -434,7 +440,7 @@ class FormMail
|
|||||||
print $defaultmessage;
|
print $defaultmessage;
|
||||||
print '</textarea>';
|
print '</textarea>';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
print "</td></tr>\n";
|
print "</td></tr>\n";
|
||||||
}
|
}
|
||||||
@@ -477,7 +483,7 @@ class FormMail
|
|||||||
print "<input type=\"text\" size=\"60\" name=\"subject\" value=\"\">";
|
print "<input type=\"text\" size=\"60\" name=\"subject\" value=\"\">";
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Message
|
// Message
|
||||||
if ($withbody)
|
if ($withbody)
|
||||||
{
|
{
|
||||||
@@ -489,7 +495,7 @@ class FormMail
|
|||||||
print "</textarea>";
|
print "</textarea>";
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Si fichier joint
|
// Si fichier joint
|
||||||
if ($withfile)
|
if ($withfile)
|
||||||
{
|
{
|
||||||
@@ -499,7 +505,7 @@ class FormMail
|
|||||||
print "<input type=\"file\" name=\"addedfile\" value=\"".$langs->trans("Upload")."\"/>";
|
print "<input type=\"file\" name=\"addedfile\" value=\"".$langs->trans("Upload")."\"/>";
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
}
|
}
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -523,7 +523,48 @@ class SMTPs
|
|||||||
var $_debug = false;
|
var $_debug = false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// DOL_CHANGE LDR
|
||||||
|
var $log = '';
|
||||||
|
var $_errorsTo = '';
|
||||||
|
var $_deliveryReceipt = 0;
|
||||||
|
|
||||||
|
function setDeliveryReceipt( $_val = 0 )
|
||||||
|
{
|
||||||
|
$this->_deliveryReceipt = $_val;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getDeliveryReceipt()
|
||||||
|
{
|
||||||
|
return $this->_deliveryReceipt;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setErrorsTo ( $_strErrorsTo )
|
||||||
|
{
|
||||||
|
if ( $_strErrorsTo )
|
||||||
|
$this->_errorsTo = $this->_strip_email ( $_strErrorsTo );
|
||||||
|
}
|
||||||
|
|
||||||
|
function getErrorsTo ( $_part = true )
|
||||||
|
{
|
||||||
|
$_retValue = '';
|
||||||
|
|
||||||
|
if ( $_part === true )
|
||||||
|
$_retValue = $this->_errorsTo;
|
||||||
|
else
|
||||||
|
$_retValue = $this->_errorsTo[$_part];
|
||||||
|
|
||||||
|
return $_retValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// =============================================================
|
// =============================================================
|
||||||
|
function setDebug ( $_vDebug = false )
|
||||||
|
{
|
||||||
|
$this->_debug = $_vDebug;
|
||||||
|
}
|
||||||
|
|
||||||
// ** Class methods
|
// ** Class methods
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1340,6 +1381,7 @@ class SMTPs
|
|||||||
return $_retValue;
|
return $_retValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method private array _buildAddrList( void )
|
* Method private array _buildAddrList( void )
|
||||||
*
|
*
|
||||||
@@ -1820,7 +1862,15 @@ class SMTPs
|
|||||||
if ( $this->_msgPriority != 3 )
|
if ( $this->_msgPriority != 3 )
|
||||||
$_header .= $this->getPriority();
|
$_header .= $this->getPriority();
|
||||||
|
|
||||||
$_header .= 'X-Mailer: SMTPs/PHP Mailer' . "\r\n"
|
|
||||||
|
// DOL_CHANGE LDR
|
||||||
|
if ( $this->getDeliveryReceipt() )
|
||||||
|
$_header .= 'Disposition-Notification-To: '.$this->getFrom('addr') . "\r\n";
|
||||||
|
if ( $this->getErrorsTo() )
|
||||||
|
$_header .= 'Errors-To: '.$this->getErrorsTo('addr') . "\r\n";
|
||||||
|
|
||||||
|
|
||||||
|
$_header .= 'X-Mailer: Dolibarr version ' . DOL_VERSION .' (using SMTPs Mailer)' . "\r\n"
|
||||||
. 'Mime-Version: 1.0' . "\r\n";
|
. 'Mime-Version: 1.0' . "\r\n";
|
||||||
|
|
||||||
return $_header;
|
return $_header;
|
||||||
@@ -2311,7 +2361,9 @@ class SMTPs
|
|||||||
|
|
||||||
function socket_send_str ( $_strSend, $_returnCode = null, $CRLF = "\r\n" )
|
function socket_send_str ( $_strSend, $_returnCode = null, $CRLF = "\r\n" )
|
||||||
{
|
{
|
||||||
|
if ($this->_debug) $this->log.=$_strSend . ": ";
|
||||||
fputs($this->socket, $_strSend . $CRLF);
|
fputs($this->socket, $_strSend . $CRLF);
|
||||||
|
if ($this->_debug) $this->log.=$_returnCode . "<br>";
|
||||||
|
|
||||||
if ( $_returnCode )
|
if ( $_returnCode )
|
||||||
return $this->server_parse($this->socket, $_returnCode);
|
return $this->server_parse($this->socket, $_returnCode);
|
||||||
@@ -2383,6 +2435,9 @@ class SMTPs
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* $Log$
|
* $Log$
|
||||||
|
* Revision 1.2 2009/02/09 00:04:35 eldy
|
||||||
|
* Added support for SMTPS protocol
|
||||||
|
*
|
||||||
* Revision 1.1 2008/04/16 23:11:45 eldy
|
* Revision 1.1 2008/04/16 23:11:45 eldy
|
||||||
* New: Add action "Test server connectivity"
|
* New: Add action "Test server connectivity"
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -177,12 +177,15 @@ MeasuringUnit=Measuring unit
|
|||||||
Emails=E-mails
|
Emails=E-mails
|
||||||
EMailsSetup=E-mails setup
|
EMailsSetup=E-mails setup
|
||||||
EMailsDesc=This page allows you to overwrite your PHP parameters for e-mails sending. In most cases on Unix/Linux OS, your PHP setup is correct and these parameters are useless.
|
EMailsDesc=This page allows you to overwrite your PHP parameters for e-mails sending. In most cases on Unix/Linux OS, your PHP setup is correct and these parameters are useless.
|
||||||
MAIN_MAIL_SMTP_PORT=SMTP Port (By default in php.ini: <b>%s</b>)
|
MAIN_MAIL_SMTP_PORT=SMTP/SMTPS Port (By default in php.ini: <b>%s</b>)
|
||||||
MAIN_MAIL_SMTP_SERVER=SMTP Host (By default in php.ini: <b>%s</b>)
|
MAIN_MAIL_SMTP_SERVER=SMTP/SMTPS Host (By default in php.ini: <b>%s</b>)
|
||||||
MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike=SMTP Port (Not defined into PHP on Unix like systems)
|
MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike=SMTP/SMTPS Port (Not defined into PHP on Unix like systems)
|
||||||
MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike=SMTP Host (Not defined into PHP on Unix like systems)
|
MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike=SMTP/SMTPS Host (Not defined into PHP on Unix like systems)
|
||||||
MAIN_MAIL_EMAIL_FROM=Sender e-mail for automatic emails (By default in php.ini: <b>%s</b>)
|
MAIN_MAIL_EMAIL_FROM=Sender e-mail for automatic emails (By default in php.ini: <b>%s</b>)
|
||||||
MAIN_DISABLE_ALL_MAILS=Disable all e-mails sendings (for test purposes or demos)
|
MAIN_DISABLE_ALL_MAILS=Disable all e-mails sendings (for test purposes or demos)
|
||||||
|
MAIN_MAIL_SENDMODE=Method to use to send EMails
|
||||||
|
MAIN_MAIL_SMTPS_ID=SMTPS ID if authentication required
|
||||||
|
MAIN_MAIL_SMTPS_PW=SMTPS Password if authentication required
|
||||||
FeatureNotAvailableOnLinux=Feature not available on Unix like systems. Test your sendmail program locally.
|
FeatureNotAvailableOnLinux=Feature not available on Unix like systems. Test your sendmail program locally.
|
||||||
ModuleSetup=Module setup
|
ModuleSetup=Module setup
|
||||||
ModulesSetup=Modules setup
|
ModulesSetup=Modules setup
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ ToAddRecipientsChooseHere=To add recipients, choose in those lists
|
|||||||
NbOfEMailingsReceived=Mass emailings received
|
NbOfEMailingsReceived=Mass emailings received
|
||||||
IdRecord=ID record
|
IdRecord=ID record
|
||||||
DeliveryReceipt=Delivery Receipt
|
DeliveryReceipt=Delivery Receipt
|
||||||
|
YouCanUseCommaSeparatorForSeveralRecipients=You can use the <b>comma</b> separator to specify several recipients.
|
||||||
|
|
||||||
# Module Notifications
|
# Module Notifications
|
||||||
Notifications=Notifications
|
Notifications=Notifications
|
||||||
|
|||||||
@@ -176,12 +176,15 @@ MeasuringUnit=Unité de mesure
|
|||||||
Emails=Emails
|
Emails=Emails
|
||||||
EMailsSetup=Configuration EMails
|
EMailsSetup=Configuration EMails
|
||||||
EMailsDesc=Cette page permet de remplacer les paramètres PHP en rapport avec l'envoi de mails. Dans la plupart des cas sur des OS comme Unix/Linux, les paramètres PHP sont déjà correcte et cette page est inutile.
|
EMailsDesc=Cette page permet de remplacer les paramètres PHP en rapport avec l'envoi de mails. Dans la plupart des cas sur des OS comme Unix/Linux, les paramètres PHP sont déjà correcte et cette page est inutile.
|
||||||
MAIN_MAIL_SMTP_PORT=Port du serveur SMTP (Par défaut dans php.ini: <b>%s</b>)
|
MAIN_MAIL_SMTP_PORT=Port du serveur SMTP/SMTPS (Par défaut dans php.ini: <b>%s</b>)
|
||||||
MAIN_MAIL_SMTP_SERVER=Nom host ou ip du serveur SMTP (Par défaut dans php.ini: <b>%s</b>)
|
MAIN_MAIL_SMTP_SERVER=Nom host ou ip du serveur SMTP/SMTPS (Par défaut dans php.ini: <b>%s</b>)
|
||||||
MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike=Port du serveur SMTP (Non défini dans le PHP sur les systemes de type Unix)
|
MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike=Port du serveur SMTP/SMTPS (Non défini dans le PHP sur les systemes de type Unix)
|
||||||
MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike=Nom host ou ip du serveur SMTP (Non défini dans le PHP sur les systemes de type Unix)
|
MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike=Nom host ou ip du serveur SMTP/SMTPS (Non défini dans le PHP sur les systemes de type Unix)
|
||||||
MAIN_MAIL_EMAIL_FROM=EMail émetteur pour envoi emails automatiques (Par défaut dans php.ini: <b>%s</b>)
|
MAIN_MAIL_EMAIL_FROM=EMail émetteur pour envoi emails automatiques (Par défaut dans php.ini: <b>%s</b>)
|
||||||
MAIN_DISABLE_ALL_MAILS=Désactiver globalement tout envoi de mails (pour mode test ou démos)
|
MAIN_DISABLE_ALL_MAILS=Désactiver globalement tout envoi de mails (pour mode test ou démos)
|
||||||
|
MAIN_MAIL_SENDMODE=Méthode d'envoi des mails
|
||||||
|
MAIN_MAIL_SMTPS_ID=SMTPS ID si authentification SMTP requise
|
||||||
|
MAIN_MAIL_SMTPS_PW=SMTPS Password si authentification SMTP requise
|
||||||
FeatureNotAvailableOnLinux=Fonctionnalité non disponible sous systemes Unix. Tester votre sendmail localement.
|
FeatureNotAvailableOnLinux=Fonctionnalité non disponible sous systemes Unix. Tester votre sendmail localement.
|
||||||
ModuleSetup=Configuration du module
|
ModuleSetup=Configuration du module
|
||||||
ModulesSetup=Configuration des modules
|
ModulesSetup=Configuration des modules
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ ToAddRecipientsChooseHere=Pour ajouter des destinataires, choisir dans les liste
|
|||||||
NbOfEMailingsReceived=Mailings de masse reçus
|
NbOfEMailingsReceived=Mailings de masse reçus
|
||||||
IdRecord=ID enregistrement
|
IdRecord=ID enregistrement
|
||||||
DeliveryReceipt=Accusé de réception
|
DeliveryReceipt=Accusé de réception
|
||||||
|
YouCanUseCommaSeparatorForSeveralRecipients=Vous pouvez utiliser le caractère de séparation <b>virgule</b> pour spécifier plusieurs destinataires.
|
||||||
|
|
||||||
# Module Notifications
|
# Module Notifications
|
||||||
Notifications=Notifications
|
Notifications=Notifications
|
||||||
|
|||||||
@@ -52,45 +52,34 @@ class CMailFile
|
|||||||
var $atleastonefile=0;
|
var $atleastonefile=0;
|
||||||
var $error='';
|
var $error='';
|
||||||
|
|
||||||
|
var $smtps; // Contains SMTPs object (if this method is used)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief CMailFile
|
* \brief CMailFile
|
||||||
\param subject sujet
|
* \param subject Topic/Subject of mail
|
||||||
\param to email destinataire (RFC 2822: "Nom prenom <email>[, ...]" ou "email[, ...]" ou "<email>[, ...]")
|
* \param to Recipients emails (RFC 2822: "Nom prenom <email>[, ...]" ou "email[, ...]" ou "<email>[, ...]")
|
||||||
\param from email emetteur (RFC 2822: "Nom prenom <email>[, ...]" ou "email[, ...]" ou "<email>[, ...]")
|
* \param from Sender email (RFC 2822: "Nom prenom <email>[, ...]" ou "email[, ...]" ou "<email>[, ...]")
|
||||||
\param msg message
|
* \param msg Message
|
||||||
\param filename_list tableau de fichiers attaches
|
* \param filename_list List of files to attach (full path of filename on file system)
|
||||||
\param mimetype_list tableau des types des fichiers attaches
|
* \param mimetype_list List of MIME type of attached files
|
||||||
\param mimefilename_list tableau des noms des fichiers attaches
|
* \param mimefilename_list List of attached file name in message
|
||||||
\param addr_cc email cc
|
* \param addr_cc Email cc
|
||||||
\param addr_bcc email bcc
|
* \param addr_bcc Email bcc
|
||||||
\param deliveryreceipt demande accuse reception
|
* \param deliveryreceipt Ask a delivery receipt
|
||||||
\param msgishtml 1=String IS already html, 0=String IS NOT html, -1=Unknown need autodetection
|
* \param msgishtml 1=String IS already html, 0=String IS NOT html, -1=Unknown need autodetection
|
||||||
*/
|
*/
|
||||||
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,$errors_to='')
|
$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, errors_to=$errors_to");
|
global $conf;
|
||||||
dolibarr_syslog("CMailFile::CMailfile: subject=$subject, deliveryreceipt=$deliveryreceipt, msgishtml=$msgishtml");
|
|
||||||
|
|
||||||
// Define if there is at least one file
|
// If ending method not defined
|
||||||
foreach ($filename_list as $i => $val)
|
if (empty($conf->global->MAIN_MAIL_SENDMODE)) $conf->global->MAIN_MAIL_SENDMODE='mail';
|
||||||
{
|
|
||||||
if ($filename_list[$i])
|
|
||||||
{
|
|
||||||
$this->atleastonefile=1;
|
|
||||||
dolibarr_syslog("CMailFile::CMailfile: filename_list[$i]=".$filename_list[$i].", mimetype_list[$i]=".$mimetype_list[$i]." mimefilename_list[$i]=".$mimefilename_list[$i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// On defini mime_boundary
|
dolibarr_syslog("CMailFile::CMailfile: MAIN_MAIL_SENDMODE=".$conf->global->MAIN_MAIL_SENDMODE." charset=".$conf->character_set_client." from=$from, to=$to, addr_cc=$addr_cc, addr_bcc=$addr_bcc, errors_to=$errors_to", LOG_DEBUG);
|
||||||
$this->mime_boundary = md5(uniqid("dolibarr"));
|
dolibarr_syslog("CMailFile::CMailfile: subject=$subject, deliveryreceipt=$deliveryreceipt, msgishtml=$msgishtml", LOG_DEBUG);
|
||||||
|
|
||||||
// On definit fin de ligne
|
|
||||||
$this->eol="\n";
|
|
||||||
if (eregi('^win',PHP_OS)) $this->eol="\r\n";
|
|
||||||
if (eregi('^mac',PHP_OS)) $this->eol="\r";
|
|
||||||
|
|
||||||
// Detect if message is HTML (use fast method)
|
// Detect if message is HTML (use fast method)
|
||||||
if ($msgishtml == -1)
|
if ($msgishtml == -1)
|
||||||
@@ -103,51 +92,257 @@ class CMailFile
|
|||||||
$this->msgishtml = $msgishtml;
|
$this->msgishtml = $msgishtml;
|
||||||
}
|
}
|
||||||
|
|
||||||
$smtp_headers = "";
|
// Define if there is at least one file
|
||||||
$mime_headers = "";
|
foreach ($filename_list as $i => $val)
|
||||||
$text_body = "";
|
|
||||||
$text_encoded = "";
|
|
||||||
|
|
||||||
// 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;
|
|
||||||
$this->deliveryreceipt = $deliveryreceipt;
|
|
||||||
$smtp_headers = $this->write_smtpheaders();
|
|
||||||
|
|
||||||
// En-tete suite dans $mime_headers
|
|
||||||
if ($this->atleastonefile)
|
|
||||||
{
|
{
|
||||||
$mime_headers = $this->write_mimeheaders($filename_list, $mimefilename_list);
|
if ($filename_list[$i])
|
||||||
|
{
|
||||||
|
$this->atleastonefile=1;
|
||||||
|
dolibarr_syslog("CMailFile::CMailfile: filename_list[$i]=".$filename_list[$i].", mimetype_list[$i]=".$mimetype_list[$i]." mimefilename_list[$i]=".$mimefilename_list[$i], LOG_DEBUG);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Corps message dans $text_body
|
// Action according to choosed sending method
|
||||||
$text_body = $this->write_body($msg, $filename_list);
|
if ($conf->global->MAIN_MAIL_SENDMODE == 'mail')
|
||||||
|
|
||||||
// Corps message suite (fichiers attaches) dans $text_encoded
|
|
||||||
if ($this->atleastonefile)
|
|
||||||
{
|
{
|
||||||
$text_encoded = $this->write_files($filename_list,$mimetype_list,$mimefilename_list);
|
// Use mail php function (default PHP method)
|
||||||
|
// ------------------------------------------
|
||||||
|
|
||||||
|
// On defini mime_boundary
|
||||||
|
$this->mime_boundary = md5(uniqid("dolibarr"));
|
||||||
|
|
||||||
|
// On definit fin de ligne
|
||||||
|
$this->eol="\n";
|
||||||
|
if (eregi('^win',PHP_OS)) $this->eol="\r\n";
|
||||||
|
if (eregi('^mac',PHP_OS)) $this->eol="\r";
|
||||||
|
|
||||||
|
$smtp_headers = "";
|
||||||
|
$mime_headers = "";
|
||||||
|
$text_body = "";
|
||||||
|
$text_encoded = "";
|
||||||
|
|
||||||
|
// 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;
|
||||||
|
$this->deliveryreceipt = $deliveryreceipt;
|
||||||
|
$smtp_headers = $this->write_smtpheaders();
|
||||||
|
|
||||||
|
// En-tete suite dans $mime_headers
|
||||||
|
if ($this->atleastonefile)
|
||||||
|
{
|
||||||
|
$mime_headers = $this->write_mimeheaders($filename_list, $mimefilename_list);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Corps message dans $text_body
|
||||||
|
$text_body = $this->write_body($msg, $filename_list);
|
||||||
|
|
||||||
|
// Corps message suite (fichiers attaches) dans $text_encoded
|
||||||
|
if ($this->atleastonefile)
|
||||||
|
{
|
||||||
|
$text_encoded = $this->write_files($filename_list,$mimetype_list,$mimefilename_list);
|
||||||
|
}
|
||||||
|
|
||||||
|
// On defini $this->headers et $this->message
|
||||||
|
$this->headers = $smtp_headers . $mime_headers;
|
||||||
|
$this->message = $text_body . $text_encoded;
|
||||||
|
|
||||||
|
// On nettoie le header pour qu'il ne se termine pas par un retour chariot.
|
||||||
|
// Ceci evite aussi les lignes vides en fin qui peuvent etre interpretees
|
||||||
|
// comme des injections mail par les serveurs de messagerie.
|
||||||
|
$this->headers = eregi_replace("[\r\n]+$","",$this->headers);
|
||||||
|
}
|
||||||
|
else if ($conf->global->MAIN_MAIL_SENDMODE == 'smtps')
|
||||||
|
{
|
||||||
|
// Use SMTPS library
|
||||||
|
// ------------------------------------------
|
||||||
|
|
||||||
|
require_once(DOL_DOCUMENT_ROOT."/includes/smtps/SMTPs.php");
|
||||||
|
$smtps = new SMTPs();
|
||||||
|
$smtps->setCharSet($conf->character_set_client);
|
||||||
|
$smtps->setSubject($subject);
|
||||||
|
$smtps->setTO($to);
|
||||||
|
$smtps->setFrom($from);
|
||||||
|
if ($this->msgishtml) $smtps->setBodyContent($msg,'html');
|
||||||
|
else $smtps->setBodyContent($msg,'plain');
|
||||||
|
|
||||||
|
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]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$smtps->setCC($sentocc);
|
||||||
|
$smtps->setBCC($sentoccc);
|
||||||
|
$smtps->setErrorsTo($errors_to);
|
||||||
|
$smtps->setDeliveryReceipt($deliveryreceipt);
|
||||||
|
|
||||||
|
$this->smtps=$smtps;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Send mail method not correctly defined
|
||||||
|
// --------------------------------------
|
||||||
|
|
||||||
|
return 'Bad value for MAIN_MAIL_SENDMODE constant';
|
||||||
}
|
}
|
||||||
|
|
||||||
// On defini $this->headers et $this->message
|
|
||||||
$this->headers = $smtp_headers . $mime_headers;
|
|
||||||
$this->message = $text_body . $text_encoded;
|
|
||||||
|
|
||||||
// On nettoie le header pour qu'il ne se termine pas par un retour chariot.
|
|
||||||
// Ceci evite aussi les lignes vides en fin qui peuvent etre interpretees
|
|
||||||
// comme des injections mail par les serveurs de messagerie.
|
|
||||||
$this->headers = eregi_replace("[\r\n]+$","",$this->headers);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Permet d'encoder un fichier
|
* \brief Send mail that was prepared by constructor
|
||||||
\param sourcefile
|
* \return boolean True if mail sent, false otherwise
|
||||||
\return <0 si erreur, fichier encode si ok
|
*/
|
||||||
|
function sendfile()
|
||||||
|
{
|
||||||
|
global $conf;
|
||||||
|
|
||||||
|
$errorlevel=error_reporting();
|
||||||
|
error_reporting($errorlevel ^ E_WARNING); // Desactive warnings
|
||||||
|
|
||||||
|
$res=false;
|
||||||
|
|
||||||
|
if (empty($conf->global->MAIN_DISABLE_ALL_MAILS))
|
||||||
|
{
|
||||||
|
// Action according to choosed sending method
|
||||||
|
if ($conf->global->MAIN_MAIL_SENDMODE == 'mail')
|
||||||
|
{
|
||||||
|
|
||||||
|
// Use mail php function (default PHP method)
|
||||||
|
// ------------------------------------------
|
||||||
|
dolibarr_syslog("CMailFile::sendfile addr_to=".$this->addr_to.", subject=".$this->subject, LOG_DEBUG);
|
||||||
|
dolibarr_syslog("CMailFile::sendfile header=\n".$this->headers, LOG_DEBUG);
|
||||||
|
//dolibarr_syslog("CMailFile::sendfile message=\n".$message);
|
||||||
|
|
||||||
|
|
||||||
|
if (! empty($conf->global->MAIN_MAIL_DEBUG)) $this->dump_mail();
|
||||||
|
|
||||||
|
|
||||||
|
// Si Windows, addr_from doit obligatoirement etre defini
|
||||||
|
if (isset($_SERVER["WINDIR"]))
|
||||||
|
{
|
||||||
|
if (empty($this->addr_from)) $this->addr_from = 'robot@mydomain.com';
|
||||||
|
@ini_set('sendmail_from',getValidAddress($this->addr_from,2));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Forcage parametres
|
||||||
|
if (! empty($conf->global->MAIN_MAIL_SMTP_SERVER)) ini_set('SMTP',$conf->global->MAIN_MAIL_SMTP_SERVER);
|
||||||
|
if (! empty($conf->global->MAIN_MAIL_SMTP_PORT)) ini_set('smtp_port',$conf->global->MAIN_MAIL_SMTP_PORT);
|
||||||
|
|
||||||
|
$dest=getValidAddress($this->addr_to,2);
|
||||||
|
if (! $dest)
|
||||||
|
{
|
||||||
|
$this->error="Failed to send mail to SMTP=".ini_get('SMTP').", PORT=".ini_get('smtp_port')."<br>Recipient address '$dest' invalid";
|
||||||
|
dolibarr_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_DEBUG);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dolibarr_syslog("CMailFile::sendfile: mail start SMTP=".ini_get('SMTP').", PORT=".ini_get('smtp_port'), LOG_DEBUG);
|
||||||
|
//dolibarr_syslog("to=".getValidAddress($this->addr_to,2).", subject=".$this->subject.", message=".stripslashes($this->message).", header=".$this->headers);
|
||||||
|
|
||||||
|
$bounce = '';
|
||||||
|
if ($conf->global->MAIN_MAIL_ALLOW_SENDMAIL_F)
|
||||||
|
{
|
||||||
|
// le return-path dans les header ne fonctionne pas avec tous les MTA
|
||||||
|
// Le passage par -f est donc possible si la constante MAIN_MAIL_ALLOW_SENDMAIL_F est definie.
|
||||||
|
// La variable definie pose des pb avec certains sendmail securisee (option -f refusee car dangereuse)
|
||||||
|
$bounce = $this->addr_from != '' ? "-f {$this->addr_from}" : "";
|
||||||
|
}
|
||||||
|
|
||||||
|
$res = mail($dest,$this->subject,stripslashes($this->message),$this->headers, $bounce);
|
||||||
|
|
||||||
|
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";
|
||||||
|
dolibarr_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_DEBUG);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dolibarr_syslog("CMailFile::sendfile: mail end success", LOG_DEBUG);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($_SERVER["WINDIR"]))
|
||||||
|
{
|
||||||
|
@ini_restore('sendmail_from');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Forcage parametres
|
||||||
|
if (! empty($conf->global->MAIN_MAIL_SMTP_SERVER)) ini_restore('SMTP');
|
||||||
|
if (! empty($conf->global->MAIN_MAIL_SMTP_PORT)) ini_restore('smtp_port');
|
||||||
|
}
|
||||||
|
else if ($conf->global->MAIN_MAIL_SENDMODE == 'smtps')
|
||||||
|
{
|
||||||
|
|
||||||
|
// Use SMTPS library
|
||||||
|
// ------------------------------------------
|
||||||
|
$this->smtps->setTransportType(0); // Only this method is coded in SMTPs library
|
||||||
|
|
||||||
|
// Forcage parametres
|
||||||
|
if (empty($conf->global->MAIN_MAIL_SMTP_SERVER)) $conf->global->MAIN_MAIL_SMTP_SERVER=ini_get('SMTP');
|
||||||
|
if (empty($conf->global->MAIN_MAIL_SMTP_PORT)) $conf->global->MAIN_MAIL_SMTP_PORT=ini_get('smtp_port');
|
||||||
|
|
||||||
|
$this->smtps->setHost($conf->global->MAIN_MAIL_SMTP_SERVER);
|
||||||
|
$this->smtps->setPort($conf->global->MAIN_MAIL_SMTP_PORT); //587 or 25;
|
||||||
|
|
||||||
|
if (! empty($conf->global->MAIN_MAIL_SMTPS_ID)) $this->smtps->setID($conf->global->MAIN_MAIL_SMTPS_ID);
|
||||||
|
if (! empty($conf->global->MAIN_MAIL_SMTPS_PW)) $this->smtps->setPW($conf->global->MAIN_MAIL_SMTPS_PW);
|
||||||
|
//$smtps->_msgReplyTo = 'reply@web.com';
|
||||||
|
|
||||||
|
$dest=$this->smtps->getFrom('org');
|
||||||
|
if (! $dest)
|
||||||
|
{
|
||||||
|
$this->error="Failed to send mail to SMTP=".$conf->global->MAIN_MAIL_SMTP_SERVER.", PORT=".$conf->global->MAIN_MAIL_SMTP_PORT."<br>Recipient address '$dest' invalid";
|
||||||
|
dolibarr_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_DEBUG);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (! empty($conf->global->MAIN_MAIL_DEBUG)) $this->smtps->setDebug(true);
|
||||||
|
$result=$this->smtps->sendMsg();
|
||||||
|
//print $resultvalue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($conf->global->MAIN_MAIL_DEBUG)) $this->dump_mail();
|
||||||
|
|
||||||
|
$result=$this->smtps->getErrors();
|
||||||
|
if (empty($this->error) && empty($result)) $res=true;
|
||||||
|
else $res=false;
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
// Send mail method not correctly defined
|
||||||
|
// --------------------------------------
|
||||||
|
|
||||||
|
return 'Bad value for MAIN_MAIL_SENDMODE constant';
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->error='No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS';
|
||||||
|
dolibarr_syslog("CMailFile::sendfile: ".$this->error);
|
||||||
|
}
|
||||||
|
|
||||||
|
error_reporting($errorlevel); // Reactive niveau erreur origine
|
||||||
|
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Permet d'encoder un fichier
|
||||||
|
* \param sourcefile
|
||||||
|
* \return <0 si erreur, fichier encode si ok
|
||||||
*/
|
*/
|
||||||
function _encode_file($sourcefile)
|
function _encode_file($sourcefile)
|
||||||
{
|
{
|
||||||
@@ -162,113 +357,37 @@ class CMailFile
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error="Error: Can't read file '$sourcefile'";
|
$this->error="Error: Can't read file '$sourcefile'";
|
||||||
dolibarr_syslog("CMailFile::encode_file: ".$this->error);
|
dolibarr_syslog("CMailFile::encode_file: ".$this->error, LOG_ERR);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Envoi le mail
|
|
||||||
\return boolean true si mail envoye, false sinon
|
|
||||||
*/
|
|
||||||
function sendfile()
|
|
||||||
{
|
|
||||||
global $conf;
|
|
||||||
|
|
||||||
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->dump_mail();
|
|
||||||
|
|
||||||
$errorlevel=error_reporting();
|
|
||||||
error_reporting($errorlevel ^ E_WARNING); // Desactive warnings
|
|
||||||
|
|
||||||
$res=false;
|
|
||||||
|
|
||||||
if (! $conf->global->MAIN_DISABLE_ALL_MAILS)
|
|
||||||
{
|
|
||||||
// Si Windows, addr_from doit obligatoirement etre defini
|
|
||||||
if (isset($_SERVER["WINDIR"]))
|
|
||||||
{
|
|
||||||
if (empty($this->addr_from)) $this->addr_from = 'robot@mydomain.com';
|
|
||||||
@ini_set('sendmail_from',getValidAddress($this->addr_from,2));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Forcage parametres
|
|
||||||
if (! empty($conf->global->MAIN_MAIL_SMTP_SERVER)) ini_set('SMTP',$conf->global->MAIN_MAIL_SMTP_SERVER);
|
|
||||||
if (! empty($conf->global->MAIN_MAIL_SMTP_PORT)) ini_set('smtp_port',$conf->global->MAIN_MAIL_SMTP_PORT);
|
|
||||||
|
|
||||||
$dest=getValidAddress($this->addr_to,2);
|
|
||||||
if (! $dest)
|
|
||||||
{
|
|
||||||
$this->error="Failed to send mail to SMTP=".ini_get('SMTP').", PORT=".ini_get('smtp_port')."<br>Recipient address '$dest' invalid";
|
|
||||||
dolibarr_syslog("CMailFile::sendfile: mail end error=".$this->error);
|
|
||||||
}
|
|
||||||
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);
|
|
||||||
|
|
||||||
$bounce = '';
|
|
||||||
if ($conf->global->MAIN_MAIL_ALLOW_SENDMAIL_F)
|
|
||||||
{
|
|
||||||
// le return-path dans les header ne fonctionne pas avec tous les MTA
|
|
||||||
// Le passage par -f est donc possible si la constante MAIN_MAIL_ALLOW_SENDMAIL_F est definie.
|
|
||||||
// La variable definie pose des pb avec certains sendmail securisee (option -f refusee car dangereuse)
|
|
||||||
$bounce = $this->addr_from != '' ? "-f {$this->addr_from}" : "";
|
|
||||||
}
|
|
||||||
|
|
||||||
$res = mail($dest,$this->subject,stripslashes($this->message),$this->headers, $bounce);
|
|
||||||
|
|
||||||
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";
|
|
||||||
dolibarr_syslog("CMailFile::sendfile: mail end error=".$this->error);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dolibarr_syslog("CMailFile::sendfile: mail end success");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($_SERVER["WINDIR"]))
|
|
||||||
{
|
|
||||||
@ini_restore('sendmail_from');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Forcage parametres
|
|
||||||
if (! empty($conf->global->MAIN_MAIL_SMTP_SERVER)) ini_restore('SMTP');
|
|
||||||
if (! empty($conf->global->MAIN_MAIL_SMTP_PORT)) ini_restore('smtp_port');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->error='No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS';
|
|
||||||
dolibarr_syslog("CMailFile::sendfile: ".$this->error);
|
|
||||||
}
|
|
||||||
|
|
||||||
error_reporting($errorlevel); // Reactive niveau erreur origine
|
|
||||||
|
|
||||||
return $res;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Ecrit le mail dans un fichier. Utilisation pour le debuggage.
|
* \brief Ecrit le mail dans un fichier. Utilisation pour le debuggage.
|
||||||
*/
|
*/
|
||||||
function dump_mail()
|
function dump_mail()
|
||||||
{
|
{
|
||||||
global $dolibarr_main_data_root;
|
global $conf,$dolibarr_main_data_root;
|
||||||
|
|
||||||
if (@is_writeable($dolibarr_main_data_root)) // Avoid fatal error on fopen with open_basedir
|
if (@is_writeable($dolibarr_main_data_root)) // Avoid fatal error on fopen with open_basedir
|
||||||
{
|
{
|
||||||
$fp = fopen($dolibarr_main_data_root."/dolibarr_mail","w");
|
$fp = fopen($dolibarr_main_data_root."/dolibarr_mail.log","w");
|
||||||
fputs($fp, $this->headers);
|
|
||||||
fputs($fp, $this->eol); // This eol is added by the mail function, so we add it in log
|
if ($conf->global->MAIN_MAIL_SENDMODE == 'mail')
|
||||||
fputs($fp, $this->message);
|
{
|
||||||
|
fputs($fp, $this->headers);
|
||||||
|
fputs($fp, $this->eol); // This eol is added by the mail function, so we add it in log
|
||||||
|
fputs($fp, $this->message);
|
||||||
|
}
|
||||||
|
elseif ($conf->global->MAIN_MAIL_SENDMODE == 'smtps')
|
||||||
|
{
|
||||||
|
fputs($fp, $this->smtps->log);
|
||||||
|
}
|
||||||
|
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
if (! empty($conf->global->MAIN_UMASK))
|
if (! empty($conf->global->MAIN_UMASK))
|
||||||
@chmod($outputfile, octdec($conf->global->MAIN_UMASK));
|
@chmod($outputfile, octdec($conf->global->MAIN_UMASK));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -295,9 +414,9 @@ class CMailFile
|
|||||||
if (isset($this->deliveryreceipt) && $this->deliveryreceipt == 1) $out .= "Disposition-Notification-To: ".getValidAddress($this->addr_from,2).$this->eol;
|
if (isset($this->deliveryreceipt) && $this->deliveryreceipt == 1) $out .= "Disposition-Notification-To: ".getValidAddress($this->addr_from,2).$this->eol;
|
||||||
|
|
||||||
//$out .= "X-Priority: 3".$this->eol;
|
//$out .= "X-Priority: 3".$this->eol;
|
||||||
$out .= "X-Mailer: Dolibarr version " . DOL_VERSION .$this->eol;
|
$out .= "X-Mailer: Dolibarr version " . DOL_VERSION ." (using php mail)".$this->eol;
|
||||||
$out .= "MIME-Version: 1.0".$this->eol;
|
$out .= "MIME-Version: 1.0".$this->eol;
|
||||||
|
|
||||||
if ($this->msgishtml)
|
if ($this->msgishtml)
|
||||||
{
|
{
|
||||||
if (! $this->atleastonefile) $out.= "Content-Type: text/html; charset=".$conf->character_set_client.$this->eol;
|
if (! $this->atleastonefile) $out.= "Content-Type: text/html; charset=".$conf->character_set_client.$this->eol;
|
||||||
@@ -309,7 +428,7 @@ class CMailFile
|
|||||||
$out.= "Content-Transfer-Encoding: 8bit".$this->eol;
|
$out.= "Content-Transfer-Encoding: 8bit".$this->eol;
|
||||||
}
|
}
|
||||||
|
|
||||||
dolibarr_syslog("CMailFile::write_smtpheaders smtp_header=\n".$out);
|
dolibarr_syslog("CMailFile::write_smtpheaders smtp_header=\n".$out, LOG_DEBUG);
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -337,14 +456,14 @@ class CMailFile
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//$out.= $this->eol;
|
//$out.= $this->eol;
|
||||||
dolibarr_syslog("CMailFile::write_mimeheaders mime_header=\n".$out);
|
dolibarr_syslog("CMailFile::write_mimeheaders mime_header=\n".$out, LOG_DEBUG);
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Permet d'ecrire le corps du message
|
* \brief Permet d'ecrire le corps du message
|
||||||
\param msgtext
|
* \param msgtext
|
||||||
\param filename_list
|
* \param filename_list
|
||||||
*/
|
*/
|
||||||
function write_body($msgtext, $filename_list)
|
function write_body($msgtext, $filename_list)
|
||||||
{
|
{
|
||||||
@@ -370,7 +489,7 @@ class CMailFile
|
|||||||
// Check if html header already in message
|
// Check if html header already in message
|
||||||
$htmlalreadyinmsg=0;
|
$htmlalreadyinmsg=0;
|
||||||
if (eregi('^[ \t]*<html',$msgtext)) $htmlalreadyinmsg=1;
|
if (eregi('^[ \t]*<html',$msgtext)) $htmlalreadyinmsg=1;
|
||||||
|
|
||||||
if (! $htmlalreadyinmsg) $out .= "<html><head><title></title></head><body>";
|
if (! $htmlalreadyinmsg) $out .= "<html><head><title></title></head><body>";
|
||||||
$out.= $msgtext;
|
$out.= $msgtext;
|
||||||
if (! $htmlalreadyinmsg) $out .= "</body></html>";
|
if (! $htmlalreadyinmsg) $out .= "</body></html>";
|
||||||
|
|||||||
Reference in New Issue
Block a user