dolibarr 18.0.6
mails_emailing.php
1<?php
2/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2009-2012 Regis Houssin <regis.houssin@inodbox.com>
4 * Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
5 * Copyright (C) 2016 Jonathan TISSEAU <jonathan.tisseau@86dev.fr>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
26// Load Dolibarr environment
27require '../main.inc.php';
28require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
29require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
30
31// Load translation files required by the page
32$langs->loadLangs(array('companies', 'products', 'admin', 'mails', 'other', 'errors'));
33
34$action = GETPOST('action', 'aZ09');
35$cancel = GETPOST('cancel', 'aZ09');
36
37$usersignature = $user->signature;
38// For action = test or send, we ensure that content is not html, even for signature, because this we want a test with NO html.
39if ($action == 'test' || $action == 'send') {
40 $usersignature = dol_string_nohtmltag($usersignature, 2);
41}
42
43$substitutionarrayfortest = array(
44 '__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT,
45 '__CHECK_READ__' => '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag=undefinedtag&securitykey='.dol_hash(getDolGlobalString('MAILING_EMAIL_UNSUBSCRIBE_KEY')."-undefinedtag", 'md5').'" width="1" height="1" style="width:1px;height:1px" border="0"/>',
46 '__USER_LOGIN__' => $user->login,
47 '__USER_EMAIL__' => $user->email,
48 '__USER_SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? $usersignature : ''), // Done into actions_sendmails
49 '__SENDEREMAIL_SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? $usersignature : ''), // Done into actions_sendmails
50 '__ID__' => 'RecipientIdRecord',
51 //'__EMAIL__' => 'RecipientEMail', // Done into actions_sendmails
52 '__LOGIN__' => $user->login,
53 '__LASTNAME__' => 'RecipientLastname',
54 '__FIRSTNAME__' => 'RecipientFirstname',
55 '__ADDRESS__'=> 'RecipientAddress',
56 '__ZIP__'=> 'RecipientZip',
57 '__TOWN_'=> 'RecipientTown',
58 '__COUNTRY__'=> 'RecipientCountry'
59);
60complete_substitutions_array($substitutionarrayfortest, $langs);
61
62// List of sending methods
63$listofmethods = array();
64$listofmethods['default'] = $langs->trans('DefaultOutgoingEmailSetup');
65$listofmethods['mail'] = 'PHP mail function';
66//$listofmethods['simplemail']='Simplemail class';
67$listofmethods['smtps'] = 'SMTP/SMTPS socket library';
68if (version_compare(phpversion(), '7.0', '>=')) {
69 $listofmethods['swiftmailer'] = 'Swift Mailer socket library';
70}
71
72// Security check
73if (!$user->admin) {
75}
76
77
78/*
79 * Actions
80 */
81
82if ($action == 'update' && !$cancel) {
83 // Send mode parameters
84 dolibarr_set_const($db, "MAIN_MAIL_SENDMODE_EMAILING", GETPOST("MAIN_MAIL_SENDMODE_EMAILING"), 'chaine', 0, '', $conf->entity);
85 dolibarr_set_const($db, "MAIN_MAIL_SMTP_PORT_EMAILING", GETPOST("MAIN_MAIL_SMTP_PORT_EMAILING"), 'chaine', 0, '', $conf->entity);
86 dolibarr_set_const($db, "MAIN_MAIL_SMTP_SERVER_EMAILING", GETPOST("MAIN_MAIL_SMTP_SERVER_EMAILING"), 'chaine', 0, '', $conf->entity);
87 dolibarr_set_const($db, "MAIN_MAIL_SMTPS_ID_EMAILING", GETPOST("MAIN_MAIL_SMTPS_ID_EMAILING"), 'chaine', 0, '', $conf->entity);
88 if (GETPOSTISSET("MAIN_MAIL_SMTPS_PW_EMAILING")) {
89 dolibarr_set_const($db, "MAIN_MAIL_SMTPS_PW_EMAILING", GETPOST("MAIN_MAIL_SMTPS_PW_EMAILING", 'none'), 'chaine', 0, '', $conf->entity);
90 }
91 if (GETPOSTISSET("MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING")) {
92 dolibarr_set_const($db, "MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING", GETPOST("MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING", 'chaine'), 'chaine', 0, '', $conf->entity);
93 }
94 if (GETPOSTISSET("MAIN_MAIL_SMTPS_OAUTH_SERVICE_EMAILING")) {
95 dolibarr_set_const($db, "MAIN_MAIL_SMTPS_OAUTH_SERVICE_EMAILING", GETPOST("MAIN_MAIL_SMTPS_OAUTH_SERVICE_EMAILING", 'chaine'), 'chaine', 0, '', $conf->entity);
96 }
97 dolibarr_set_const($db, "MAIN_MAIL_EMAIL_TLS_EMAILING", GETPOST("MAIN_MAIL_EMAIL_TLS_EMAILING"), 'chaine', 0, '', $conf->entity);
98 dolibarr_set_const($db, "MAIN_MAIL_EMAIL_STARTTLS_EMAILING", GETPOST("MAIN_MAIL_EMAIL_STARTTLS_EMAILING"), 'chaine', 0, '', $conf->entity);
99 dolibarr_set_const($db, "MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING", GETPOST("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING"), 'chaine', 0, '', $conf->entity);
100
101 header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
102 exit;
103}
104
105
106// Actions to send emails
107$id = 0;
108$actiontypecode = ''; // Not an event for agenda
109$triggersendname = ''; // Disable triggers
110$paramname = 'id';
111$mode = 'emailfortest';
112$trackid = (($action == 'testhtml') ? "testhtml" : "test");
113$sendcontext = 'emailing'; // Force to use dedicated context of setup for emailing
114include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
115
116if ($action == 'presend' && GETPOST('trackid', 'alphanohtml') == 'test') {
117 $action = 'test';
118}
119if ($action == 'presend' && GETPOST('trackid', 'alphanohtml') == 'testhtml') {
120 $action = 'testhtml';
121}
122
123
124
125
126/*
127 * View
128 */
129
130$form = new Form($db);
131
132$linuxlike = 1;
133if (preg_match('/^win/i', PHP_OS)) {
134 $linuxlike = 0;
135}
136if (preg_match('/^mac/i', PHP_OS)) {
137 $linuxlike = 0;
138}
139
140if (empty($conf->global->MAIN_MAIL_SENDMODE_EMAILING)) {
141 $conf->global->MAIN_MAIL_SENDMODE_EMAILING = 'default';
142}
143$port = !empty($conf->global->MAIN_MAIL_SMTP_PORT_EMAILING) ? $conf->global->MAIN_MAIL_SMTP_PORT_EMAILING : ini_get('smtp_port');
144if (!$port) {
145 $port = 25;
146}
147$server = !empty($conf->global->MAIN_MAIL_SMTP_SERVER_EMAILING) ? $conf->global->MAIN_MAIL_SMTP_SERVER_EMAILING : ini_get('SMTP');
148if (!$server) {
149 $server = '127.0.0.1';
150}
151
152
153$wikihelp = 'EN:Setup_EMails|FR:Paramétrage_EMails|ES:Configuración_EMails';
154llxHeader('', $langs->trans("Setup"), $wikihelp);
155
156print load_fiche_titre($langs->trans("EMailsSetup"), '', 'title_setup');
157
159
160// List of oauth services
161$oauthservices = array();
162
163foreach ($conf->global as $key => $val) {
164 if (!empty($val) && preg_match('/^OAUTH_.*_ID$/', $key)) {
165 $key = preg_replace('/^OAUTH_/', '', $key);
166 $key = preg_replace('/_ID$/', '', $key);
167 if (preg_match('/^.*-/', $key)) {
168 $name = preg_replace('/^.*-/', '', $key);
169 } else {
170 $name = $langs->trans("NoName");
171 }
172 $provider = preg_replace('/-.*$/', '', $key);
173 $provider = ucfirst(strtolower($provider));
174
175 $oauthservices[$key] = $name." (".$provider.")";
176 }
177}
178
179if ($action == 'edit') {
180 if ($conf->use_javascript_ajax) {
181 print "\n".'<script type="text/javascript">';
182 print 'jQuery(document).ready(function () {
183 function initfields()
184 {
185 if (jQuery("#MAIN_MAIL_SENDMODE_EMAILING").val()==\'default\')
186 {
187 jQuery(".hideifdefault").hide();
188 }
189 else
190 {
191 jQuery(".hideifdefault").show();
192 }
193
194 if (jQuery("#MAIN_MAIL_SENDMODE_EMAILING").val()==\'mail\')
195 {
196 jQuery(".drag").hide();
197 jQuery("#MAIN_MAIL_EMAIL_TLS_EMAILING").val(0);
198 jQuery("#MAIN_MAIL_EMAIL_TLS_EMAILING").prop("disabled", true);
199 jQuery("#MAIN_MAIL_EMAIL_STARTTLS_EMAILING").val(0);
200 jQuery("#MAIN_MAIL_EMAIL_STARTTLS_EMAILING").prop("disabled", true);
201 jQuery("#MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING").val(0);
202 jQuery("#MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING").prop("disabled", true);
203 jQuery(".smtp_method").hide();
204 jQuery(".smtp_auth_method").hide();
205 ';
206 if ($linuxlike) {
207 print '
208 jQuery("#MAIN_MAIL_SMTP_SERVER_EMAILING").hide();
209 jQuery("#MAIN_MAIL_SMTP_PORT_EMAILING").hide();
210 jQuery("#smtp_server_mess").show();
211 jQuery("#smtp_port_mess").show();
212 ';
213 } else {
214 print '
215 jQuery("#MAIN_MAIL_SMTP_SERVER_EMAILING").prop("disabled", true);
216 jQuery("#MAIN_MAIL_SMTP_PORT_EMAILING").prop("disabled", true);
217 jQuery("#smtp_server_mess").hide();
218 jQuery("#smtp_port_mess").hide();
219 ';
220 }
221 print '
222 }
223 if (jQuery("#MAIN_MAIL_SENDMODE_EMAILING").val()==\'smtps\')
224 {
225 jQuery(".drag").show();
226 jQuery("#MAIN_MAIL_EMAIL_TLS_EMAILING").val('.$conf->global->MAIN_MAIL_EMAIL_TLS_EMAILING.');
227 jQuery("#MAIN_MAIL_EMAIL_TLS_EMAILING").removeAttr("disabled");
228 jQuery("#MAIN_MAIL_EMAIL_STARTTLS_EMAILING").val('.$conf->global->MAIN_MAIL_EMAIL_STARTTLS_EMAILING.');
229 jQuery("#MAIN_MAIL_EMAIL_STARTTLS_EMAILING").removeAttr("disabled");
230 jQuery("#MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING").val('.$conf->global->MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING.');
231 jQuery("#MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING").removeAttr("disabled");
232 jQuery("#MAIN_MAIL_SMTP_SERVER_EMAILING").removeAttr("disabled");
233 jQuery("#MAIN_MAIL_SMTP_PORT_EMAILING").removeAttr("disabled");
234 jQuery("#MAIN_MAIL_SMTP_SERVER_EMAILING").show();
235 jQuery("#MAIN_MAIL_SMTP_PORT_EMAILING").show();
236 jQuery("#smtp_port_mess").hide();
237 jQuery("#smtp_server_mess").hide();
238 jQuery(".smtp_method").show();
239 jQuery(".smtp_auth_method").show();
240 }
241 if (jQuery("#MAIN_MAIL_SENDMODE_EMAILING").val()==\'swiftmailer\')
242 {
243 jQuery(".drag").show();
244 jQuery("#MAIN_MAIL_EMAIL_TLS_EMAILING").val('.$conf->global->MAIN_MAIL_EMAIL_TLS_EMAILING.');
245 jQuery("#MAIN_MAIL_EMAIL_TLS_EMAILING").removeAttr("disabled");
246 jQuery("#MAIN_MAIL_EMAIL_STARTTLS_EMAILING").val('.$conf->global->MAIN_MAIL_EMAIL_STARTTLS_EMAILING.');
247 jQuery("#MAIN_MAIL_EMAIL_STARTTLS_EMAILING").removeAttr("disabled");
248 jQuery("#MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING").val('.$conf->global->MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING.');
249 jQuery("#MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING").removeAttr("disabled");
250 jQuery("#MAIN_MAIL_SMTP_SERVER_EMAILING").removeAttr("disabled");
251 jQuery("#MAIN_MAIL_SMTP_PORT_EMAILING").removeAttr("disabled");
252 jQuery("#MAIN_MAIL_SMTP_SERVER_EMAILING").show();
253 jQuery("#MAIN_MAIL_SMTP_PORT_EMAILING").show();
254 jQuery("#smtp_server_mess").hide();
255 jQuery("#smtp_port_mess").hide();
256 jQuery(".smtp_method").show();
257 jQuery(".smtp_auth_method").show();
258 }
259 }
260 function change_smtp_auth_method() {
261 console.log(jQuery("#radio_pw").prop("checked"));
262 if (jQuery("#MAIN_MAIL_SENDMODE_EMAILING").val()==\'smtps\' && jQuery("#radio_oauth").prop("checked")) {
263 jQuery(".smtp_oauth_service").show();
264 jQuery(".smtp_pw").hide();
265 } else if (jQuery("#MAIN_MAIL_SENDMODE_EMAILING").val()==\'swiftmailer\' && jQuery("#radio_oauth").prop("checked")) {
266 jQuery(".smtp_oauth_service").show();
267 jQuery(".smtp_pw").hide();
268 } else if(jQuery("#MAIN_MAIL_SENDMODE_EMAILING").val()==\'mail\' || jQuery("#MAIN_MAIL_SENDMODE_EMAILING").val()==\'default\'){
269 jQuery(".smtp_oauth_service").hide();
270 jQuery(".smtp_pw").hide();
271 } else {
272 jQuery(".smtp_oauth_service").hide();
273 jQuery(".smtp_pw").show();
274 }
275 }
276 initfields();
277 change_smtp_auth_method();
278 jQuery("#MAIN_MAIL_SENDMODE_EMAILING").change(function() {
279 initfields();
280 change_smtp_auth_method();
281 });
282 jQuery("#radio_pw, #radio_oauth").change(function() {
283 change_smtp_auth_method();
284 });
285 jQuery("#MAIN_MAIL_EMAIL_TLS_EMAILING").change(function() {
286 if (jQuery("#MAIN_MAIL_EMAIL_TLS_EMAILING").val() == 1)
287 jQuery("#MAIN_MAIL_EMAIL_STARTTLS_EMAILING").val(0);
288 else
289 jQuery("#MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING").val(0);
290 });
291 jQuery("#MAIN_MAIL_EMAIL_STARTTLS_EMAILING").change(function() {
292 if (jQuery("#MAIN_MAIL_EMAIL_STARTTLS_EMAILING").val() == 1)
293 jQuery("#MAIN_MAIL_EMAIL_TLS_EMAILING").val(0);
294 else
295 jQuery("#MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING").val(0);
296 });
297 })';
298 print '</script>'."\n";
299 }
300
301 print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
302 print '<input type="hidden" name="token" value="'.newToken().'">';
303 print '<input type="hidden" name="action" value="update">';
304
305 print dol_get_fiche_head($head, 'common_emailing', '', -1);
306
307 print '<span class="opacitymedium">'.$langs->trans("EMailsDesc")."</span><br>\n";
308 print "<br><br>\n";
309
310
311 clearstatcache();
312
313 print '<table class="noborder centpercent">';
314 print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
315
316 // Method
317
318 print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SENDMODE").'</td><td>';
319
320 // SuperAdministrator access only
321 if ((empty($conf->global->MAIN_MODULE_MULTICOMPANY)) || ($user->admin && !$user->entity)) {
322 print $form->selectarray('MAIN_MAIL_SENDMODE_EMAILING', $listofmethods, $conf->global->MAIN_MAIL_SENDMODE_EMAILING);
323 } else {
324 $text = $listofmethods[$conf->global->MAIN_MAIL_SENDMODE_EMAILING];
325 if (empty($text)) {
326 $text = $langs->trans("Undefined");
327 }
328 $htmltext = $langs->trans("ContactSuperAdminForChange");
329 print $form->textwithpicto($text, $htmltext, 1, 'superadmin');
330 print '<input type="hidden" name="MAIN_MAIL_SENDMODE_EMAILING" value="'.$conf->global->MAIN_MAIL_SENDMODE_EMAILING.'">';
331 }
332 print '</td></tr>';
333
334 // Host server
335
336 print '<tr class="oddeven hideifdefault">';
337 if (!$conf->use_javascript_ajax && $linuxlike && $conf->global->MAIN_MAIL_SENDMODE_EMAILING == 'mail') {
338 print '<td>';
339 print $langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike");
340 print '</td><td>';
341 print '<span class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
342 print '</td>';
343 } else {
344 print '<td>';
345 $mainserver = (!empty($conf->global->MAIN_MAIL_SMTP_SERVER_EMAILING) ? $conf->global->MAIN_MAIL_SMTP_SERVER_EMAILING : '');
346 $smtpserver = ini_get('SMTP') ?ini_get('SMTP') : $langs->transnoentities("Undefined");
347 if ($linuxlike) {
348 print $langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike");
349 } else {
350 print $langs->trans("MAIN_MAIL_SMTP_SERVER", $smtpserver);
351 }
352 print '</td><td>';
353 // SuperAdministrator access only
354 if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
355 print '<input class="flat minwidth300" id="MAIN_MAIL_SMTP_SERVER_EMAILING" name="MAIN_MAIL_SMTP_SERVER_EMAILING" size="18" value="' . $mainserver . '">';
356 print '<input type="hidden" id="MAIN_MAIL_SMTP_SERVER_EMAILING_sav" name="MAIN_MAIL_SMTP_SERVER_EMAILING_sav" value="' . $mainserver . '">';
357 print '<span id="smtp_server_mess" class="opacitymedium">' . $langs->trans("SeeLocalSendMailSetup") . '</span>';
358 print ' <span class="opacitymedium smtp_method">' . $langs->trans("SeeLinkToOnlineDocumentation") . '</span>';
359 } else {
360 $text = !empty($mainserver) ? $mainserver : $smtpserver;
361 $htmltext = $langs->trans("ContactSuperAdminForChange");
362 print $form->textwithpicto($text, $htmltext, 1, 'superadmin');
363 print '<input type="hidden" id="MAIN_MAIL_SMTP_SERVER_EMAILING" name="MAIN_MAIL_SMTP_SERVER_EMAILING" value="' . $mainserver . '">';
364 }
365 print '</td>';
366 }
367 print '</tr>';
368
369 // Port
370
371 print '<tr class="oddeven hideifdefault"><td>';
372 if (!$conf->use_javascript_ajax && $linuxlike && $conf->global->MAIN_MAIL_SENDMODE_EMAILING == 'mail') {
373 print $langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike");
374 print '</td><td>';
375 print '<span class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
376 } else {
377 $mainport = (!empty($conf->global->MAIN_MAIL_SMTP_PORT_EMAILING) ? $conf->global->MAIN_MAIL_SMTP_PORT_EMAILING : '');
378 $smtpport = ini_get('smtp_port') ?ini_get('smtp_port') : $langs->transnoentities("Undefined");
379 if ($linuxlike) {
380 print $langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike");
381 } else {
382 print $langs->trans("MAIN_MAIL_SMTP_PORT", $smtpport);
383 }
384 print '</td><td>';
385 // SuperAdministrator access only
386 if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
387 print '<input class="flat" id="MAIN_MAIL_SMTP_PORT_EMAILING" name="MAIN_MAIL_SMTP_PORT_EMAILING" size="3" value="' . $mainport . '">';
388 print '<input type="hidden" id="MAIN_MAIL_SMTP_PORT_EMAILING_sav" name="MAIN_MAIL_SMTP_PORT_EMAILING_sav" value="' . $mainport . '">';
389 print '<span id="smtp_port_mess" class="opacitymedium">' . $langs->trans("SeeLocalSendMailSetup") . '</span>';
390 } else {
391 $text = (!empty($mainport) ? $mainport : $smtpport);
392 $htmltext = $langs->trans("ContactSuperAdminForChange");
393 print $form->textwithpicto($text, $htmltext, 1, 'superadmin');
394 print '<input type="hidden" id="MAIN_MAIL_SMTP_PORT_EMAILING" name="MAIN_MAIL_SMTP_PORT_EMAILING" value="' . $mainport . '">';
395 }
396 }
397 print '</td></tr>';
398
399 // AUTH method
400 if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))) {
401 print '<tr class="oddeven smtp_auth_method hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE").'</td><td>';
402 if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
403 // Note: Default value for MAIN_MAIL_SMTPS_AUTH_TYPE if not defined is 'LOGIN' (but login/pass may be empty and they won't be provided in such a case)
404 print '<input type="radio" id="radio_pw" name="MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING" value="LOGIN"'.(getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING', 'LOGIN') == 'LOGIN' ? ' checked' : '').'> ';
405 print '<label for="radio_pw" >'.$langs->trans("UsePassword").'</label>';
406 print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
407 print '<input type="radio" id="radio_oauth" name="MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING" value="XOAUTH2"'.(getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING') == 'XOAUTH2' ? ' checked' : '').'> ';
408 print '<label for="radio_oauth" >'.$form->textwithpicto($langs->trans("UseOauth"), $langs->trans("OauthNotAvailableForAllAndHadToBeCreatedBefore")).'</label>';
409 } else {
410 $value = getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING', 'LOGIN');
411 $htmltext = $langs->trans("ContactSuperAdminForChange");
412 print $form->textwithpicto($langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE"), $htmltext, 1, 'superadmin');
413 print '<input type="hidden" id="MAIN_MAIL_SMTPS_AUTH_TYPE" name="MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING" value="'.$value.'">';
414 }
415 print '</td></tr>';
416 }
417
418 // ID
419 if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))) {
420 $mainstmpid = (!empty($conf->global->MAIN_MAIL_SMTPS_ID_EMAILING) ? $conf->global->MAIN_MAIL_SMTPS_ID_EMAILING : '');
421 print '<tr class="drag drop oddeven hideifdefault"><td>' . $langs->trans("MAIN_MAIL_SMTPS_ID") . '</td><td>';
422 // SuperAdministrator access only
423 if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
424 print '<input class="flat" name="MAIN_MAIL_SMTPS_ID_EMAILING" size="32" value="' . $mainstmpid . '">';
425 } else {
426 $htmltext = $langs->trans("ContactSuperAdminForChange");
427 print $form->textwithpicto($conf->global->MAIN_MAIL_SMTPS_ID_EMAILING, $htmltext, 1, 'superadmin');
428 print '<input type="hidden" name="MAIN_MAIL_SMTPS_ID_EMAILING" value="' . $mainstmpid . '">';
429 }
430 print '</td></tr>';
431 }
432
433 // PW
434 if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))) {
435 $mainsmtppw = (!empty($conf->global->MAIN_MAIL_SMTPS_PW_EMAILING) ? $conf->global->MAIN_MAIL_SMTPS_PW_EMAILING : '');
436 print '<tr class="drag drop oddeven smtp_pw hideifdefault"><td>' . $langs->trans("MAIN_MAIL_SMTPS_PW") . '</td><td>';
437 // SuperAdministrator access only
438 if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
439 print '<input class="flat" type="password" name="MAIN_MAIL_SMTPS_PW_EMAILING" size="32" value="' . $mainsmtppw . '">';
440 } else {
441 $htmltext = $langs->trans("ContactSuperAdminForChange");
442 print $form->textwithpicto($conf->global->MAIN_MAIL_SMTPS_PW_EMAILING, $htmltext, 1, 'superadmin');
443 print '<input type="hidden" name="MAIN_MAIL_SMTPS_PW_EMAILING" value="' . $mainsmtppw . '">';
444 }
445 print '</td></tr>';
446 }
447
448 // OAUTH service provider
449 if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))) {
450 print '<tr class="oddeven smtp_oauth_service hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_OAUTH_SERVICE").'</td><td>';
451
452 // SuperAdministrator access only
453 if ((empty($conf->global->MAIN_MODULE_MULTICOMPANY)) || ($user->admin && !$user->entity)) {
454 print $form->selectarray('MAIN_MAIL_SMTPS_OAUTH_SERVICE_EMAILING', $oauthservices, $conf->global->MAIN_MAIL_SMTPS_OAUTH_SERVICE_EMAILING);
455 } else {
456 $text = $oauthservices[$conf->global->MAIN_MAIL_SMTPS_OAUTH_SERVICE_EMAILING];
457 if (empty($text)) {
458 $text = $langs->trans("Undefined");
459 }
460 $htmltext = $langs->trans("ContactSuperAdminForChange");
461 print $form->textwithpicto($text, $htmltext, 1, 'superadmin');
462 print '<input type="hidden" name="MAIN_MAIL_SMTPS_OAUTH_SERVICE_EMAILING" value="'.$conf->global->MAIN_MAIL_SMTPS_OAUTH_SERVICE_EMAILING.'">';
463 }
464 print '</td></tr>';
465 }
466
467
468 // TLS
469 print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_EMAIL_TLS").'</td><td>';
470 if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))) {
471 if (function_exists('openssl_open')) {
472 print $form->selectyesno('MAIN_MAIL_EMAIL_TLS_EMAILING', (!empty($conf->global->MAIN_MAIL_EMAIL_TLS_EMAILING) ? $conf->global->MAIN_MAIL_EMAIL_TLS_EMAILING : 0), 1);
473 } else {
474 print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
475 }
476 } else {
477 print yn(0).' ('.$langs->trans("NotSupported").')';
478 }
479 print '</td></tr>';
480
481 // STARTTLS
482 print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").'</td><td>';
483 if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))) {
484 if (function_exists('openssl_open')) {
485 print $form->selectyesno('MAIN_MAIL_EMAIL_STARTTLS_EMAILING', (!empty($conf->global->MAIN_MAIL_EMAIL_STARTTLS_EMAILING) ? $conf->global->MAIN_MAIL_EMAIL_STARTTLS_EMAILING : 0), 1);
486 } else {
487 print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
488 }
489 } else {
490 print yn(0).' ('.$langs->trans("NotSupported").')';
491 }
492 print '</td></tr>';
493
494 // SMTP_ALLOW_SELF_SIGNED_EMAILING
495 print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").'</td><td>';
496 if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))) {
497 if (function_exists('openssl_open')) {
498 print $form->selectyesno('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING', (!empty($conf->global->MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING) ? $conf->global->MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING : 0), 1);
499 } else {
500 print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
501 }
502 } else {
503 print yn(0).' ('.$langs->trans("NotSupported").')';
504 }
505 print '</td></tr>';
506
507 print '</table>';
508
509 print dol_get_fiche_end();
510
511 print $form->buttonsSaveCancel();
512
513 print '</form>';
514} else {
515 print dol_get_fiche_head($head, 'common_emailing', '', -1);
516
517 print '<span class="opacitymedium">'.$langs->trans("EMailsDesc")."</span><br>\n";
518 print "<br><br>\n";
519
520 print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
521 print '<table class="noborder centpercent">';
522 print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
523
524 // Method
525 print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SENDMODE").'</td><td>';
526 $text = $listofmethods[getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING')];
527 if (empty($text)) {
528 $text = $langs->trans("Undefined").img_warning();
529 }
530 if (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') == 'default') {
531 print '<span class="opacitymedium">'.$text.'</span>';
532 } else {
533 print $text;
534 }
535 print '</td></tr>';
536
537 if (!empty($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && $conf->global->MAIN_MAIL_SENDMODE_EMAILING != 'default') {
538 // Host server
539 if ($linuxlike && (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && $conf->global->MAIN_MAIL_SENDMODE_EMAILING == 'mail')) {
540 print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike").'</td><td>'.$langs->trans("SeeLocalSendMailSetup").'</td></tr>';
541 } else {
542 print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTP_SERVER", ini_get('SMTP') ?ini_get('SMTP') : $langs->transnoentities("Undefined")).'</td><td>'.(!empty($conf->global->MAIN_MAIL_SMTP_SERVER_EMAILING) ? $conf->global->MAIN_MAIL_SMTP_SERVER_EMAILING : '').'</td></tr>';
543 }
544
545 // Port
546 if ($linuxlike && (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && $conf->global->MAIN_MAIL_SENDMODE_EMAILING == 'mail')) {
547 print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike").'</td><td>'.$langs->trans("SeeLocalSendMailSetup").'</td></tr>';
548 } else {
549 print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTP_PORT", ini_get('smtp_port') ?ini_get('smtp_port') : $langs->transnoentities("Undefined")).'</td><td>'.(!empty($conf->global->MAIN_MAIL_SMTP_PORT_EMAILING) ? $conf->global->MAIN_MAIL_SMTP_PORT_EMAILING : '').'</td></tr>';
550 }
551
552 // AUTH method
553 if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING'), array('smtps', 'swiftmailer'))) {
554 $authtype = getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING', 'LOGIN');
555 $text = ($authtype === "LOGIN") ? $langs->trans("UsePassword") : ($authtype === "XOAUTH2" ? $langs->trans("UseOauth") : '') ;
556 print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE").'</td><td>'.$text.'</td></tr>';
557 }
558
559 // SMTPS ID
560 if (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer'))) {
561 print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_ID").'</td><td>'.getDolGlobalString('MAIN_MAIL_SMTPS_ID_EMAILING').'</td></tr>';
562 }
563
564 // SMTPS PW
565 if (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')) && getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING') != "XOAUTH2") {
566 print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_PW").'</td><td>'.preg_replace('/./', '*', getDolGlobalString('MAIN_MAIL_SMTPS_PW_EMAILING')).'</td></tr>';
567 }
568
569 // SMTPS oauth service
570 if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING'), array('smtps', 'swiftmailer')) && getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING') === "XOAUTH2") {
571 $text = $oauthservices[$conf->global->MAIN_MAIL_SMTPS_OAUTH_SERVICE_EMAILING];
572 if (empty($text)) {
573 $text = $langs->trans("Undefined").img_warning();
574 }
575 print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_OAUTH_SERVICE_EMAILING").'</td><td>'.$text.'</td></tr>';
576 }
577
578
579 // TLS
580 print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_EMAIL_TLS").'</td><td>';
581 if (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer'))) {
582 if (function_exists('openssl_open')) {
583 print yn($conf->global->MAIN_MAIL_EMAIL_TLS_EMAILING);
584 } else {
585 print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
586 }
587 } else {
588 print '<span class="opacitymedium">'.yn(0).' ('.$langs->trans("NotSupported").')</span>';
589 }
590 print '</td></tr>';
591
592 // STARTTLS
593 print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").'</td><td>';
594 if (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer'))) {
595 if (function_exists('openssl_open')) {
596 print yn($conf->global->MAIN_MAIL_EMAIL_STARTTLS_EMAILING);
597 } else {
598 print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
599 }
600 } else {
601 print yn(0).' ('.$langs->trans("NotSupported").')';
602 }
603 print '</td></tr>';
604
605 // SMTP_ALLOW_SELF_SIGNED_EMAILING
606 print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").'</td><td>';
607 if (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer'))) {
608 if (function_exists('openssl_open')) {
609 print yn(getDolGlobalInt('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING'));
610 } else {
611 print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
612 }
613 } else {
614 print yn(0).' ('.$langs->trans("NotSupported").')';
615 }
616 print '</td></tr>';
617 }
618
619 print '</table>';
620 print '</div>';
621
622 print dol_get_fiche_end();
623
624
625 if ($conf->global->MAIN_MAIL_SENDMODE_EMAILING == 'mail' && empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA)) {
626 print '<br>';
627 /*
628 // Warning 1
629 if ($linuxlike) {
630 $sendmailoption=ini_get('mail.force_extra_parameters');
631 if (empty($sendmailoption) || ! preg_match('/ba/',$sendmailoption)) {
632 print info_admin($langs->trans("SendmailOptionNotComplete"));
633 }
634 }*/
635 // Warning 2
636 print info_admin($langs->trans("SendmailOptionMayHurtBuggedMTA"));
637 }
638
639
640 // Buttons for actions
641
642 print '<div class="tabsAction">';
643
644 print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'">'.$langs->trans("Modify").'</a>';
645
646 if (!empty($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && $conf->global->MAIN_MAIL_SENDMODE_EMAILING != 'default') {
647 if ($conf->global->MAIN_MAIL_SENDMODE_EMAILING != 'mail' || !$linuxlike) {
648 if (function_exists('fsockopen') && $port && $server) {
649 print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=testconnect">' . $langs->trans("DoTestServerAvailability") . '</a>';
650 }
651 } else {
652 print '<a class="butActionRefused classfortooltip" href="#" title="' . $langs->trans("FeatureNotAvailableOnLinux") . '">' . $langs->trans("DoTestServerAvailability") . '</a>';
653 }
654
655 print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=test&amp;mode=init">' . $langs->trans("DoTestSend") . '</a>';
656
657 if (isModEnabled('fckeditor')) {
658 print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=testhtml&amp;mode=init">' . $langs->trans("DoTestSendHTML") . '</a>';
659 }
660 }
661
662 print '</div>';
663
664
665 if ($conf->global->MAIN_MAIL_SENDMODE_EMAILING == 'mail' && !in_array($action, array('testconnect', 'test', 'testhtml'))) {
666 $text = $langs->trans("WarningPHPMail");
667 print info_admin($text);
668 }
669
670 // Run the test to connect
671 if ($action == 'testconnect') {
672 print '<div id="formmailaftertstconnect" name="formmailaftertstconnect"></div>';
673 print load_fiche_titre($langs->trans("DoTestServerAvailability"));
674
675 include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
676 $mail = new CMailFile('', '', '', '', array(), array(), array(), '', '', 0, '', '', '', '', $trackid, $sendcontext);
677
678 $result = $mail->check_server_port($server, $port);
679 if ($result) {
680 print '<div class="ok">'.$langs->trans("ServerAvailableOnIPOrPort", $server, $port).'</div>';
681 } else {
682 $errormsg = $langs->trans("ServerNotAvailableOnIPOrPort", $server, $port);
683
684 if ($mail->error) {
685 $errormsg .= ' - '.$mail->error;
686 }
687
688 setEventMessages($errormsg, null, 'errors');
689 }
690 print '<br>';
691 }
692
693 // Show email send test form
694 if ($action == 'test' || $action == 'testhtml') {
695 print '<div id="formmailbeforetitle" name="formmailbeforetitle"></div>';
696 print load_fiche_titre($action == 'testhtml' ? $langs->trans("DoTestSendHTML") : $langs->trans("DoTestSend"));
697
698 print dol_get_fiche_head('');
699
700 // Cree l'objet formulaire mail
701 include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
702 $formmail = new FormMail($db);
703 $formmail->trackid = (($action == 'testhtml') ? "testhtml" : "test");
704 $formmail->fromname = (GETPOSTISSET('fromname') ? GETPOST('fromname', 'restricthtml') : $conf->global->MAIN_MAIL_EMAIL_FROM);
705 $formmail->frommail = (GETPOSTISSET('frommail') ? GETPOST('frommail', 'restricthtml') : $conf->global->MAIN_MAIL_EMAIL_FROM);
706 $formmail->fromid = $user->id;
707 $formmail->fromalsorobot = 1;
708 $formmail->withfromreadonly = 0;
709 $formmail->withsubstit = 0;
710 $formmail->withfrom = 1;
711 $formmail->witherrorsto = 1;
712 $formmail->withto = (GETPOSTISSET('sendto') ? GETPOST('sendto', 'restricthtml') : ($user->email ? $user->email : 1));
713 $formmail->withtocc = (GETPOSTISSET('sendtocc') ? GETPOST('sendtocc', 'restricthtml') : 1); // ! empty to keep field if empty
714 $formmail->withtoccc = (GETPOSTISSET('sendtoccc') ? GETPOST('sendtoccc', 'restricthtml') : 1); // ! empty to keep field if empty
715 $formmail->withtopic = (GETPOSTISSET('subject') ? GETPOST('subject') : $langs->trans("Test"));
716 $formmail->withtopicreadonly = 0;
717 $formmail->withfile = 2;
718 $formmail->withbody = (GETPOSTISSET('message') ? GETPOST('message', 'restricthtml') : ($action == 'testhtml' ? $langs->transnoentities("PredefinedMailTestHtml") : $langs->transnoentities("PredefinedMailTest")));
719 $formmail->withbodyreadonly = 0;
720 $formmail->withcancel = 1;
721 $formmail->withdeliveryreceipt = 1;
722 $formmail->withfckeditor = ($action == 'testhtml' ? 1 : 0);
723 $formmail->ckeditortoolbar = 'dolibarr_mailings';
724 // Tableau des substitutions
725 $formmail->substit = $substitutionarrayfortest;
726 // Tableau des parametres complementaires du post
727 $formmail->param["action"] = "send";
728 $formmail->param["models"] = "body";
729 $formmail->param["mailid"] = 0;
730 $formmail->param["returnurl"] = $_SERVER["PHP_SELF"];
731
732 // Init list of files
733 if (GETPOST("mode", "aZ09") == 'init') {
734 $formmail->clear_attached_files();
735 }
736
737 print $formmail->get_form('addfile', 'removefile');
738
739 print dol_get_fiche_end();
740 }
741}
742
743// End of page
744llxFooter();
745$db->close();
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
email_admin_prepare_head()
Return array head with list of tabs to view object informations.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Definition wrapper.php:56
llxFooter()
Empty footer.
Definition wrapper.php:70
Class to send emails (with attachments or not) Usage: $mailfile = new CMailFile($subject,...
Class to manage generation of HTML components Only common components must be here.
Classe permettant la generation du formulaire html d'envoi de mail unitaire Usage: $formail = new For...
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
complete_substitutions_array(&$substitutionarray, $outputlangs, $object=null, $parameters=null, $callfunc="completesubstitutionarray")
Complete the $substitutionarray with more entries coming from external module that had set the "subst...
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='')
Show information for admin users or standard users.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_hash($chain, $type='0')
Returns a hash (non reversible encryption) of a string.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.