dolibarr 21.0.0-beta
mails_ticket.php
Go to the documentation of this file.
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 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
27// Load Dolibarr environment
28require '../main.inc.php';
29require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
30require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
31
40// Load translation files required by the page
41$langs->loadLangs(array('companies', 'products', 'admin', 'mails', 'other', 'errors'));
42
43$action = GETPOST('action', 'aZ09');
44$cancel = GETPOST('cancel', 'aZ09');
45
46$usersignature = $user->signature;
47// For action = test or send, we ensure that content is not html, even for signature, because this we want a test with NO html.
48if ($action == 'test' || $action == 'send') {
49 $usersignature = dol_string_nohtmltag($usersignature, 2);
50}
51
52$substitutionarrayfortest = array(
53 '__ID__' => 'TESTIdRecord',
54 '__USER_LOGIN__' => $user->login,
55 '__USER_EMAIL__' => $user->email,
56 '__USER_SIGNATURE__' => (($user->signature && !getDolGlobalString('MAIN_MAIL_DO_NOT_USE_SIGN')) ? $usersignature : ''), // Done into actions_sendmails
57 '__SENDEREMAIL_SIGNATURE__' => (($user->signature && !getDolGlobalString('MAIN_MAIL_DO_NOT_USE_SIGN')) ? $usersignature : ''), // Done into actions_sendmails
58 '__LASTNAME__' => 'RecipientLastname',
59 '__FIRSTNAME__' => 'RecipientFirstname',
60 '__ADDRESS__' => 'RecipientAddress',
61 '__ZIP__' => 'RecipientZip',
62 '__TOWN_' => 'RecipientTown',
63 '__COUNTRY__' => 'RecipientCountry',
64 '__DOL_MAIN_URL_ROOT__' => DOL_MAIN_URL_ROOT,
65);
66complete_substitutions_array($substitutionarrayfortest, $langs);
67
68// List of sending methods
69$listofmethods = array();
70$listofmethods['default'] = $langs->trans('DefaultOutgoingEmailSetup');
71$listofmethods['mail'] = 'PHP mail function';
72//$listofmethods['simplemail']='Simplemail class';
73$listofmethods['smtps'] = 'SMTP/SMTPS socket library';
74if (version_compare(phpversion(), '7.0', '>=')) {
75 $listofmethods['swiftmailer'] = 'Swift Mailer socket library';
76}
77
78// Security check
79if (!$user->admin) {
81}
82
83
84/*
85 * Actions
86 */
87
88if ($action == 'update' && !$cancel) {
89 // Send mode parameters
90 dolibarr_set_const($db, "MAIN_MAIL_SENDMODE_TICKET", GETPOST("MAIN_MAIL_SENDMODE_TICKET"), 'chaine', 0, '', $conf->entity);
91 dolibarr_set_const($db, "MAIN_MAIL_SMTP_PORT_TICKET", GETPOST("MAIN_MAIL_SMTP_PORT_TICKET"), 'chaine', 0, '', $conf->entity);
92 dolibarr_set_const($db, "MAIN_MAIL_SMTP_SERVER_TICKET", GETPOST("MAIN_MAIL_SMTP_SERVER_TICKET"), 'chaine', 0, '', $conf->entity);
93 dolibarr_set_const($db, "MAIN_MAIL_SMTPS_ID_TICKET", GETPOST("MAIN_MAIL_SMTPS_ID_TICKET"), 'chaine', 0, '', $conf->entity);
94 if (GETPOSTISSET("MAIN_MAIL_SMTPS_PW_TICKET")) {
95 dolibarr_set_const($db, "MAIN_MAIL_SMTPS_PW_TICKET", GETPOST("MAIN_MAIL_SMTPS_PW_TICKET", 'password'), 'chaine', 0, '', $conf->entity);
96 }
97 if (GETPOSTISSET("MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET")) {
98 dolibarr_set_const($db, "MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET", GETPOST("MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
99 }
100 if (GETPOSTISSET("MAIN_MAIL_SMTPS_OAUTH_SERVICE_TICKET")) {
101 dolibarr_set_const($db, "MAIN_MAIL_SMTPS_OAUTH_SERVICE_TICKET", GETPOST("MAIN_MAIL_SMTPS_OAUTH_SERVICE_TICKET", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
102 }
103 dolibarr_set_const($db, "MAIN_MAIL_EMAIL_TLS_TICKET", GETPOST("MAIN_MAIL_EMAIL_TLS_TICKET"), 'chaine', 0, '', $conf->entity);
104 dolibarr_set_const($db, "MAIN_MAIL_EMAIL_STARTTLS_TICKET", GETPOST("MAIN_MAIL_EMAIL_STARTTLS_TICKET"), 'chaine', 0, '', $conf->entity);
105 dolibarr_set_const($db, "MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_TICKET", GETPOST("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_TICKET"), 'chaine', 0, '', $conf->entity);
106
107 header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
108 exit;
109}
110
111
112// Actions to send emails
113$id = 0;
114$actiontypecode = ''; // Not an event for agenda
115$triggersendname = ''; // Disable triggers
116$paramname = 'id';
117$mode = 'emailfortest';
118$trackid = (($action == 'testhtml') ? "testhtml" : "test");
119$sendcontext = 'ticket'; // Force to use dedicated context of setup for ticket
120include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
121
122if ($action == 'presend' && GETPOST('trackid', 'alphanohtml') == 'test') {
123 $action = 'test';
124}
125if ($action == 'presend' && GETPOST('trackid', 'alphanohtml') == 'testhtml') {
126 $action = 'testhtml';
127}
128
129
130
131
132/*
133 * View
134 */
135
136$form = new Form($db);
137
138$linuxlike = 1;
139if (preg_match('/^win/i', PHP_OS)) {
140 $linuxlike = 0;
141}
142if (preg_match('/^mac/i', PHP_OS)) {
143 $linuxlike = 0;
144}
145
146if (!getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET')) {
147 $conf->global->MAIN_MAIL_SENDMODE_TICKET = 'default';
148}
149$port = getDolGlobalInt('MAIN_MAIL_SMTP_PORT_TICKET', (int) ini_get('smtp_port'));
150if (!$port) {
151 $port = 25;
152}
153$server = getDolGlobalString('MAIN_MAIL_SMTP_SERVER_TICKET', ini_get('SMTP'));
154if (!$server) {
155 $server = '127.0.0.1';
156}
157
158
159$wikihelp = 'EN:Setup_EMails|FR:Paramétrage_EMails|ES:Configuración_EMails';
160llxHeader('', $langs->trans("Setup"), $wikihelp, '', 0, 0, '', '', '', 'mod-admin page-mails_ticket');
161
162print load_fiche_titre($langs->trans("EMailsSetup"), '', 'title_setup');
163
165
166// List of oauth services
167$oauthservices = array();
168
169foreach ($conf->global as $key => $val) {
170 if (!empty($val) && preg_match('/^OAUTH_.*_ID$/', $key)) {
171 $key = preg_replace('/^OAUTH_/', '', $key);
172 $key = preg_replace('/_ID$/', '', $key);
173 if (preg_match('/^.*-/', $key)) {
174 $name = preg_replace('/^.*-/', '', $key);
175 } else {
176 $name = $langs->trans("NoName");
177 }
178 $provider = preg_replace('/-.*$/', '', $key);
179 $provider = ucfirst(strtolower($provider));
180
181 $oauthservices[$key] = $name." (".$provider.")";
182 }
183}
184
185
186if ($action == 'edit') {
187 if ($conf->use_javascript_ajax) {
188 print "\n".'<script type="text/javascript">';
189 print 'jQuery(document).ready(function () {
190 function initfields()
191 {
192 if (jQuery("#MAIN_MAIL_SENDMODE_TICKET").val()==\'default\')
193 {
194 jQuery(".hideifdefault").hide();
195 }
196 else
197 {
198 jQuery(".hideifdefault").show();
199 }
200
201 if (jQuery("#MAIN_MAIL_SENDMODE_TICKET").val()==\'mail\')
202 {
203 console.log("I choose php mail mode");
204 jQuery(".drag").hide();
205 jQuery("#MAIN_MAIL_EMAIL_TLS_TICKET").val(0);
206 jQuery("#MAIN_MAIL_EMAIL_TLS_TICKET").prop("disabled", true);
207 jQuery("#MAIN_MAIL_EMAIL_STARTTLS_TICKET").val(0);
208 jQuery("#MAIN_MAIL_EMAIL_STARTTLS_TICKET").prop("disabled", true);
209 jQuery("#MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_TICKET").val(0);
210 jQuery("#MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_TICKET").prop("disabled", true);
211 jQuery("#MAIN_MAIL_EMAIL_DKIM_ENABLED_TICKET").val(0);
212 jQuery("#MAIN_MAIL_EMAIL_DKIM_ENABLED_TICKET").prop("disabled", true);
213 jQuery("#MAIN_MAIL_EMAIL_DKIM_DOMAIN_TICKET").prop("disabled", true);
214 jQuery("#MAIN_MAIL_EMAIL_DKIM_SELECTOR_TICKET").prop("disabled", true);
215 jQuery("#MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY_TICKET").prop("disabled", true);
216 jQuery(".smtp_method").hide();
217 jQuery(".dkim").hide();
218 jQuery(".smtp_auth_method").hide();
219 ';
220 if ($linuxlike) {
221 print '
222 jQuery("#MAIN_MAIL_SMTP_SERVER_TICKET").hide();
223 jQuery("#MAIN_MAIL_SMTP_PORT_TICKET").hide();
224 jQuery("#smtp_server_mess").show();
225 jQuery("#smtp_port_mess").show();
226 ';
227 } else {
228 print '
229 jQuery("#MAIN_MAIL_SMTP_SERVER_TICKET").prop("disabled", true);
230 jQuery("#MAIN_MAIL_SMTP_PORT_TICKET").prop("disabled", true);
231 jQuery("#smtp_server_mess").hide();
232 jQuery("#smtp_port_mess").hide();
233 ';
234 }
235 print '
236 }
237 if (jQuery("#MAIN_MAIL_SENDMODE_TICKET").val()==\'smtps\')
238 {
239 console.log("I choose smtps mail mode");
240 jQuery(".drag").show();
241 jQuery("#MAIN_MAIL_EMAIL_TLS_TICKET").val(' . getDolGlobalString('MAIN_MAIL_EMAIL_TLS_TICKET').');
242 jQuery("#MAIN_MAIL_EMAIL_TLS_TICKET").removeAttr("disabled");
243 jQuery("#MAIN_MAIL_EMAIL_STARTTLS_TICKET").val(' . getDolGlobalString('MAIN_MAIL_EMAIL_STARTTLS_TICKET').');
244 jQuery("#MAIN_MAIL_EMAIL_STARTTLS_TICKET").removeAttr("disabled");
245 jQuery("#MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_TICKET").val(' . getDolGlobalString('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_TICKET').');
246 jQuery("#MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_TICKET").removeAttr("disabled");
247 jQuery("#MAIN_MAIL_EMAIL_DKIM_ENABLED_TICKET").val(0);
248 jQuery("#MAIN_MAIL_EMAIL_DKIM_ENABLED_TICKET").prop("disabled", true);
249 jQuery("#MAIN_MAIL_EMAIL_DKIM_DOMAIN_TICKET").prop("disabled", true);
250 jQuery("#MAIN_MAIL_EMAIL_DKIM_SELECTOR_TICKET").prop("disabled", true);
251 jQuery("#MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY_TICKET").prop("disabled", true);
252 jQuery("#MAIN_MAIL_EMAIL_DKIM_DOMAIN_TICKET").hide();
253 jQuery("#MAIN_MAIL_EMAIL_DKIM_SELECTOR_TICKET").hide();
254 jQuery("#MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY_TICKET").hide();
255 jQuery("#MAIN_MAIL_SMTP_SERVER_TICKET").removeAttr("disabled");
256 jQuery("#MAIN_MAIL_SMTP_PORT_TICKET").removeAttr("disabled");
257 jQuery("#MAIN_MAIL_SMTP_SERVER_TICKET").show();
258 jQuery("#MAIN_MAIL_SMTP_PORT_TICKET").show();
259 jQuery("#smtp_server_mess").hide();
260 jQuery("#smtp_port_mess").hide();
261 jQuery(".smtp_method").show();
262 jQuery(".dkim").hide();
263 jQuery(".smtp_auth_method").show();
264 }
265 if (jQuery("#MAIN_MAIL_SENDMODE_TICKET").val()==\'swiftmailer\')
266 {
267 console.log("I choose swiftmailer mail mode");
268 jQuery(".drag").show();
269 jQuery("#MAIN_MAIL_EMAIL_TLS_TICKET").val(' . getDolGlobalString('MAIN_MAIL_EMAIL_TLS_TICKET').');
270 jQuery("#MAIN_MAIL_EMAIL_TLS_TICKET").removeAttr("disabled");
271 jQuery("#MAIN_MAIL_EMAIL_STARTTLS_TICKET").val(' . getDolGlobalString('MAIN_MAIL_EMAIL_STARTTLS_TICKET').');
272 jQuery("#MAIN_MAIL_EMAIL_STARTTLS_TICKET").removeAttr("disabled");
273 jQuery("#MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_TICKET").val(' . getDolGlobalString('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_TICKET').');
274 jQuery("#MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_TICKET").removeAttr("disabled");
275 jQuery("#MAIN_MAIL_EMAIL_DKIM_ENABLED_TICKET").val(0);
276 jQuery("#MAIN_MAIL_EMAIL_DKIM_ENABLED_TICKET").prop("disabled", true);
277 jQuery("#MAIN_MAIL_EMAIL_DKIM_DOMAIN_TICKET").prop("disabled", true);
278 jQuery("#MAIN_MAIL_EMAIL_DKIM_SELECTOR_TICKET").prop("disabled", true);
279 jQuery("#MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY_TICKET").prop("disabled", true);
280 jQuery("#MAIN_MAIL_EMAIL_DKIM_DOMAIN_TICKET").hide();
281 jQuery("#MAIN_MAIL_EMAIL_DKIM_SELECTOR_TICKET").hide();
282 jQuery("#MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY_TICKET").hide();
283 jQuery("#MAIN_MAIL_SMTP_SERVER_TICKET").removeAttr("disabled");
284 jQuery("#MAIN_MAIL_SMTP_PORT_TICKET").removeAttr("disabled");
285 jQuery("#MAIN_MAIL_SMTP_SERVER_TICKET").show();
286 jQuery("#MAIN_MAIL_SMTP_PORT_TICKET").show();
287 jQuery("#smtp_server_mess").hide();
288 jQuery("#smtp_port_mess").hide();
289 jQuery(".smtp_method").show();
290 jQuery(".dkim").show();
291 jQuery(".smtp_auth_method").show();
292 }
293 }
294 function change_smtp_auth_method() {
295 console.log("Call smtp auth method "+jQuery("#MAIN_MAIL_SENDMODE_TICKET").val());
296 if (jQuery("#MAIN_MAIL_SENDMODE_TICKET").val()==\'smtps\') {
297 if (jQuery("#radio_oauth").prop("checked")) {
298 jQuery(".smtp_pw").hide();
299 jQuery(".smtp_oauth_service").show();
300 } else {
301 jQuery(".smtp_pw").show();
302 jQuery(".smtp_oauth_service").hide();
303 }
304 } else if (jQuery("#MAIN_MAIL_SENDMODE_TICKET").val()==\'swiftmailer\') {
305 if (jQuery("#radio_oauth").prop("checked")) {
306 jQuery(".smtp_pw").hide();
307 jQuery(".smtp_oauth_service").show();
308 } else {
309 jQuery(".smtp_pw").show();
310 jQuery(".smtp_oauth_service").hide();
311 }
312 } else {
313 jQuery(".smtp_pw").hide();
314 jQuery(".smtp_oauth_service").hide();
315 }
316 }
317
318 initfields();
319 change_smtp_auth_method();
320
321 jQuery("#MAIN_MAIL_SENDMODE_TICKET").change(function() {
322 initfields();
323 change_smtp_auth_method();
324 });
325 jQuery("#radio_pw, #radio_plain, #radio_oauth").change(function() {
326 change_smtp_auth_method();
327 });
328 jQuery("#MAIN_MAIL_EMAIL_TLS").change(function() {
329 if (jQuery("#MAIN_MAIL_EMAIL_STARTTLS_TICKET").val() == 1)
330 jQuery("#MAIN_MAIL_EMAIL_STARTTLS_TICKET").val(0);
331 });
332 jQuery("#MAIN_MAIL_EMAIL_STARTTLS_TICKET").change(function() {
333 if (jQuery("#MAIN_MAIL_EMAIL_TLS_TICKET").val() == 1)
334 jQuery("#MAIN_MAIL_EMAIL_TLS_TICKET").val(0);
335 });
336 })';
337 print '</script>'."\n";
338 }
339
340 print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
341 print '<input type="hidden" name="token" value="'.newToken().'">';
342 print '<input type="hidden" name="action" value="update">';
343
344 print dol_get_fiche_head($head, 'common_ticket', '', -1);
345
346 print '<span class="opacitymedium">'.$langs->trans("EMailsDesc")."</span><br>\n";
347 print "<br><br>\n";
348
349
350 clearstatcache();
351
352 print '<table class="noborder centpercent">';
353 print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameters").'</td><td></td></tr>';
354
355 // Method
356
357 print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SENDMODE").'</td><td>';
358
359 // SuperAdministrator access only
360 if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
361 print $form->selectarray('MAIN_MAIL_SENDMODE_TICKET', $listofmethods, getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET'));
362 } else {
363 $text = $listofmethods[getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET')];
364 if (empty($text)) {
365 $text = $langs->trans("Undefined");
366 }
367 $htmltext = $langs->trans("ContactSuperAdminForChange");
368 print $form->textwithpicto($text, $htmltext, 1, 'superadmin');
369 print '<input type="hidden" name="MAIN_MAIL_SENDMODE_TICKET" value="' . getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET').'">';
370 }
371 print '</td></tr>';
372
373 // Host server
374
375 print '<tr class="oddeven hideifdefault">';
376 if (!$conf->use_javascript_ajax && $linuxlike && getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') == 'mail') {
377 print '<td>';
378 print $langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike");
379 print '</td><td>';
380 print '<span class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
381 print '</td>';
382 } else {
383 print '<td>';
384 $mainserver = getDolGlobalString('MAIN_MAIL_SMTP_SERVER_TICKET');
385 $smtpserver = ini_get('SMTP') ? ini_get('SMTP') : $langs->transnoentities("Undefined");
386 if ($linuxlike) {
387 print $langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike");
388 } else {
389 print $langs->trans("MAIN_MAIL_SMTP_SERVER", $smtpserver);
390 }
391 print '</td><td>';
392 // SuperAdministrator access only
393 if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
394 print '<input class="flat minwidth300" id="MAIN_MAIL_SMTP_SERVER_TICKET" name="MAIN_MAIL_SMTP_SERVER_TICKET" size="18" value="'.$mainserver.'">';
395 print '<input type="hidden" id="MAIN_MAIL_SMTP_SERVER_TICKET_sav" name="MAIN_MAIL_SMTP_SERVER_TICKET_sav" value="'.$mainserver.'">';
396 print '<span id="smtp_server_mess" class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
397 print ' <span class="opacitymedium smtp_method">' . $langs->trans("SeeLinkToOnlineDocumentation") . '</span>';
398 } else {
399 $text = !empty($mainserver) ? $mainserver : $smtpserver;
400 $htmltext = $langs->trans("ContactSuperAdminForChange");
401 print $form->textwithpicto($text, $htmltext, 1, 'superadmin');
402 print '<input type="hidden" id="MAIN_MAIL_SMTP_SERVER_TICKET" name="MAIN_MAIL_SMTP_SERVER_TICKET" value="'.$mainserver.'">';
403 }
404 print '</td>';
405 }
406 print '</tr>';
407
408 // Port
409
410 print '<tr class="oddeven hideifdefault hideonmodemail"><td>';
411 if (!$conf->use_javascript_ajax && $linuxlike && getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') == 'mail') {
412 print $langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike");
413 print '</td><td>';
414 print '<span class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
415 } else {
416 $mainport = getDolGlobalString('MAIN_MAIL_SMTP_PORT_TICKET');
417 $smtpport = ini_get('smtp_port') ? ini_get('smtp_port') : $langs->transnoentities("Undefined");
418 if ($linuxlike) {
419 print $langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike");
420 } else {
421 print $langs->trans("MAIN_MAIL_SMTP_PORT", $smtpport);
422 }
423 print '</td><td>';
424 // SuperAdministrator access only
425 if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
426 print '<input class="flat" id="MAIN_MAIL_SMTP_PORT_TICKET" name="MAIN_MAIL_SMTP_PORT_TICKET" size="3" value="'.$mainport.'">';
427 print '<input type="hidden" id="MAIN_MAIL_SMTP_PORT_TICKET_sav" name="MAIN_MAIL_SMTP_PORT_TICKET_sav" value="'.$mainport.'">';
428 print '<span id="smtp_port_mess" class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
429 } else {
430 $text = (!empty($mainport) ? $mainport : $smtpport);
431 $htmltext = $langs->trans("ContactSuperAdminForChange");
432 print $form->textwithpicto($text, $htmltext, 1, 'superadmin');
433 print '<input type="hidden" id="MAIN_MAIL_SMTP_PORT_TICKET" name="MAIN_MAIL_SMTP_PORT_TICKET" value="'.$mainport.'">';
434 }
435 }
436 print '</td></tr>';
437
438 // AUTH method
439 if (!empty($conf->use_javascript_ajax) || in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET'), array('smtps', 'swiftmailer'))) {
440 print '<tr class="oddeven smtp_auth_method hideonmodemail hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE").'</td><td>';
441 $vartosmtpstype = 'MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET';
442 if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
443 // 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)
444 print '<input type="radio" id="radio_pw" name="'.$vartosmtpstype.'" value="LOGIN"'.(getDolGlobalString($vartosmtpstype, 'LOGIN') == 'LOGIN' ? ' checked' : '').'> ';
445 print '<label for="radio_pw" >'.$langs->trans("UseAUTHLOGIN").'</label>';
446 print '<br>';
447 print '<input type="radio" id="radio_plain" name="'.$vartosmtpstype.'" value="PLAIN"'.(getDolGlobalString($vartosmtpstype, 'PLAIN') == 'PLAIN' ? ' checked' : '').'> ';
448 print '<label for="radio_plain" >'.$langs->trans("UseAUTHPLAIN").'</label>';
449 print '<br>';
450 print '<input type="radio" id="radio_oauth" name="'.$vartosmtpstype.'" value="XOAUTH2"'.(getDolGlobalString($vartosmtpstype) == 'XOAUTH2' ? ' checked' : '').(isModEnabled('oauth') ? '' : ' disabled').'> ';
451 print '<label for="radio_oauth" >'.$form->textwithpicto($langs->trans("UseOauth"), $langs->trans("OauthNotAvailableForAllAndHadToBeCreatedBefore")).'</label>';
452 if (!isModEnabled('oauth')) {
453 print ' &nbsp; <a href="'.DOL_URL_ROOT.'/admin/modules.php?search_keyword=oauth">'.$langs->trans("EnableModuleX", "OAuth").'</a>';
454 } else {
455 print ' &nbsp; <a href="'.DOL_URL_ROOT.'/admin/oauth.php">'.$langs->trans("SetupModuleX", " OAuth").'</a>';
456 }
457 } else {
458 $value = getDolGlobalString($vartosmtpstype, 'LOGIN');
459 $htmltext = $langs->trans("ContactSuperAdminForChange");
460 print $form->textwithpicto($langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE"), $htmltext, 1, 'superadmin');
461 print '<input type="hidden" id="MAIN_MAIL_SMTPS_AUTH_TYPE" name="MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET" value="'.$value.'">';
462 }
463 print '</td></tr>';
464 }
465
466 // ID
467 if (!empty($conf->use_javascript_ajax) || in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET'), array('smtps', 'swiftmailer'))) {
468 $mainstmpid = getDolGlobalString('MAIN_MAIL_SMTPS_ID_TICKET');
469 print '<tr class="drag drop oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_ID").'</td><td>';
470 // SuperAdministrator access only
471 if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
472 print '<input class="flat" name="MAIN_MAIL_SMTPS_ID_TICKET" size="32" value="'.$mainstmpid.'">';
473 } else {
474 $htmltext = $langs->trans("ContactSuperAdminForChange");
475 print $form->textwithpicto(getDolGlobalString('MAIN_MAIL_SMTPS_ID_TICKET'), $htmltext, 1, 'superadmin');
476 print '<input type="hidden" name="MAIN_MAIL_SMTPS_ID_TICKET" value="'.$mainstmpid.'">';
477 }
478 print '</td></tr>';
479 }
480
481 // PW
482 if (!empty($conf->use_javascript_ajax) || in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET'), array('smtps', 'swiftmailer'))) {
483 $mainsmtppw = getDolGlobalString('MAIN_MAIL_SMTPS_PW_TICKET');
484 print '<tr class="drag drop oddeven smtp_pw hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_PW").'</td><td>';
485 // SuperAdministrator access only
486 if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
487 print '<input class="flat" type="password" name="MAIN_MAIL_SMTPS_PW_TICKET" size="32" value="'.$mainsmtppw.'">';
488 } else {
489 $htmltext = $langs->trans("ContactSuperAdminForChange");
490 print $form->textwithpicto(getDolGlobalString('MAIN_MAIL_SMTPS_PW_TICKET'), $htmltext, 1, 'superadmin');
491 print '<input type="hidden" name="MAIN_MAIL_SMTPS_PW_TICKET" value="'.$mainsmtppw.'">';
492 }
493 print '</td></tr>';
494 }
495
496 // OAUTH service provider
497 if (!empty($conf->use_javascript_ajax) || in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET'), array('smtps', 'swiftmailer'))) {
498 print '<tr class="oddeven smtp_oauth_service hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_OAUTH_SERVICE").'</td><td>';
499 // SuperAdministrator access only
500 if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
501 print $form->selectarray('MAIN_MAIL_SMTPS_OAUTH_SERVICE_TICKET', $oauthservices, getDolGlobalString('MAIN_MAIL_SMTPS_OAUTH_SERVICE_TICKET'));
502 } else {
503 $text = $oauthservices[getDolGlobalString('MAIN_MAIL_SMTPS_OAUTH_SERVICE_TICKET')];
504 if (empty($text)) {
505 $text = $langs->trans("Undefined");
506 }
507 $htmltext = $langs->trans("ContactSuperAdminForChange");
508 print $form->textwithpicto($text, $htmltext, 1, 'superadmin');
509 print '<input type="hidden" name="MAIN_MAIL_SMTPS_OAUTH_SERVICE_TICKET" value="' . getDolGlobalString('MAIN_MAIL_SMTPS_OAUTH_SERVICE_TICKET').'">';
510 }
511 print '</td></tr>';
512 }
513
514 // TLS
515 print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_EMAIL_TLS").'</td><td>';
516 if (!empty($conf->use_javascript_ajax) || in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET'), array('smtps', 'swiftmailer'))) {
517 if (function_exists('openssl_open')) {
518 print $form->selectyesno('MAIN_MAIL_EMAIL_TLS_TICKET', (getDolGlobalString('MAIN_MAIL_EMAIL_TLS_TICKET') ? getDolGlobalString('MAIN_MAIL_EMAIL_TLS_TICKET') : 0), 1);
519 } else {
520 print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
521 }
522 } else {
523 print yn(0).' ('.$langs->trans("NotSupported").')';
524 }
525 print '</td></tr>';
526
527 // STARTTLS
528 print '<tr class="oddeven hideifdefault hideonmodemail"><td>'.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").'</td><td>';
529 if (!empty($conf->use_javascript_ajax) || in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET'), array('smtps', 'swiftmailer'))) {
530 if (function_exists('openssl_open')) {
531 print $form->selectyesno('MAIN_MAIL_EMAIL_STARTTLS_TICKET', (getDolGlobalString('MAIN_MAIL_EMAIL_STARTTLS_TICKET') ? getDolGlobalString('MAIN_MAIL_EMAIL_STARTTLS_TICKET') : 0), 1);
532 } else {
533 print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
534 }
535 } else {
536 print yn(0).' ('.$langs->trans("NotSupported").')';
537 }
538 print '</td></tr>';
539
540 // SMTP_ALLOW_SELF_SIGNED_TICKET
541 print '<tr class="oddeven hideifdefault hideonmodemail"><td>'.$langs->trans("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").'</td><td>';
542 if (!empty($conf->use_javascript_ajax) || in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET'), array('smtps', 'swiftmailer'))) {
543 if (function_exists('openssl_open')) {
544 print $form->selectyesno('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_TICKET', (getDolGlobalString('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_TICKET') ? getDolGlobalString('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_TICKET') : 0), 1);
545 } else {
546 print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
547 }
548 } else {
549 print yn(0).' ('.$langs->trans("NotSupported").')';
550 }
551 print '</td></tr>';
552
553 print '</table>';
554
555 print dol_get_fiche_end();
556
557 print $form->buttonsSaveCancel();
558
559 print '</form>';
560} else {
561 print dol_get_fiche_head($head, 'common_ticket', '', -1);
562
563 print '<span class="opacitymedium">'.$langs->trans("EMailsDesc")."</span><br>\n";
564 print "<br><br>\n";
565
566 print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
567 print '<table class="noborder centpercent">';
568 print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameters").'</td><td></td></tr>';
569
570 // Method
571 print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SENDMODE").'</td><td>';
572 $text = $listofmethods[getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET')];
573 if (empty($text)) {
574 $text = $langs->trans("Undefined").img_warning();
575 }
576 if (getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') == 'default') {
577 print '<span class="opacitymedium">'.$text.'</span>';
578 } else {
579 print $text;
580 }
581 print '</td></tr>';
582
583 if (getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') && getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') != 'default') {
584 // Host server
585 if ($linuxlike && (getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') == 'mail')) {
586 //print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike").'</td><td>'.$langs->trans("SeeLocalSendMailSetup").'</td></tr>';
587 } else {
588 print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTP_SERVER", ini_get('SMTP') ? ini_get('SMTP') : $langs->transnoentities("Undefined")).'</td><td>'.getDolGlobalString('MAIN_MAIL_SMTP_SERVER_TICKET').'</td></tr>';
589 }
590
591 // Port
592 if ($linuxlike && (getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') == 'mail')) {
593 //print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike").'</td><td>'.$langs->trans("SeeLocalSendMailSetup").'</td></tr>';
594 } else {
595 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>'.getDolGlobalString('MAIN_MAIL_SMTP_PORT_TICKET').'</td></tr>';
596 }
597
598 // AUTH method
599 if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET'), array('smtps', 'swiftmailer'))) {
600 $authtype = getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET', 'LOGIN');
601 $text = '';
602 if ($authtype === "LOGIN") {
603 $text = $langs->trans("UseAUTHLOGIN");
604 } elseif ($authtype === "PLAIN") {
605 $text = $langs->trans("UseAUTHPLAIN");
606 } elseif ($authtype === "XOAUTH2") {
607 $text = $langs->trans("UseOauth");
608 }
609 print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE").'</td><td>'.$text.'</td></tr>';
610 }
611
612 // SMTPS ID
613 if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET'), array('smtps', 'swiftmailer'))) {
614 print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_ID").'</td><td>'.getDolGlobalString('MAIN_MAIL_SMTPS_ID_TICKET').'</td></tr>';
615 }
616
617 // SMTPS PW
618 if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET'), array('smtps', 'swiftmailer')) && getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET') != "XOAUTH2") {
619 print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_PW").'</td><td>'.preg_replace('/./', '*', getDolGlobalString('MAIN_MAIL_SMTPS_PW_TICKET')).'</td></tr>';
620 }
621
622 // SMTPS oauth service
623 if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET'), array('smtps', 'swiftmailer')) && getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET') === "XOAUTH2") {
624 $text = $oauthservices[getDolGlobalString('MAIN_MAIL_SMTPS_OAUTH_SERVICE_TICKET')];
625 if (empty($text)) {
626 $text = $langs->trans("Undefined").img_warning();
627 }
628 print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_OAUTH_SERVICE").'</td><td>'.$text.'</td></tr>';
629 }
630
631 // TLS
632 if ($linuxlike && (getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail') == 'mail')) {
633 // Nothing
634 } else {
635 print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_EMAIL_TLS").'</td><td>';
636 if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET'), array('smtps', 'swiftmailer'))) {
637 if (function_exists('openssl_open')) {
638 print yn(getDolGlobalString('MAIN_MAIL_EMAIL_TLS_TICKET'));
639 } else {
640 print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
641 }
642 } else {
643 print '<span class="opacitymedium">'.yn(0).' ('.$langs->trans("NotSupported").')</span>';
644 }
645 print '</td></tr>';
646 }
647
648 // STARTTLS
649 if ($linuxlike && (getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail') == 'mail')) {
650 // Nothing
651 } else {
652 print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").'</td><td>';
653 if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET'), array('smtps', 'swiftmailer'))) {
654 if (function_exists('openssl_open')) {
655 print yn(getDolGlobalString('MAIN_MAIL_EMAIL_STARTTLS_TICKET'));
656 } else {
657 print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
658 }
659 } else {
660 print '<span class="opacitymedium">'.yn(0).' ('.$langs->trans("NotSupported").')</span>';
661 }
662 print '</td></tr>';
663 }
664
665 // SMTP_ALLOW_SELF_SIGNED_EMAILING
666 if ($linuxlike && (getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail') == 'mail')) {
667 // Nothing
668 } else {
669 print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").'</td><td>';
670 if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET'), array('smtps', 'swiftmailer'))) {
671 if (function_exists('openssl_open')) {
672 print yn(getDolGlobalInt('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_TICKET'));
673 } else {
674 print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
675 }
676 } else {
677 print '<span class="opacitymedium">'.yn(0).' ('.$langs->trans("NotSupported").')</span>';
678 }
679 print '</td></tr>';
680 }
681 }
682
683 print '</table>';
684 print '</div>';
685
686 print dol_get_fiche_end();
687
688
689 if (getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') == 'mail' && !getDolGlobalString('MAIN_FIX_FOR_BUGGED_MTA')) {
690 print '<br>';
691 /*
692 // Warning 1
693 if ($linuxlike) {
694 $sendmailoption=ini_get('mail.force_extra_parameters');
695 if (empty($sendmailoption) || ! preg_match('/ba/',$sendmailoption))
696 {
697 print info_admin($langs->trans("SendmailOptionNotComplete"));
698 }
699 }*/
700 // Warning 2
701 print info_admin($langs->trans("SendmailOptionMayHurtBuggedMTA"));
702 }
703
704
705 // Buttons for actions
706
707 print '<div class="tabsAction">';
708
709 print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'">'.$langs->trans("Modify").'</a>';
710
711 if (getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') && getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') != 'default') {
712 if (getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') != 'mail' || !$linuxlike) {
713 if (function_exists('fsockopen') && $port && $server) {
714 print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=testconnect">'.$langs->trans("DoTestServerAvailability").'</a>';
715 }
716 } else {
717 print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("FeatureNotAvailableOnLinux").'">'.$langs->trans("DoTestServerAvailability").'</a>';
718 }
719
720 print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=test&amp;mode=init">'.$langs->trans("DoTestSend").'</a>';
721
722 if (isModEnabled('fckeditor')) {
723 print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=testhtml&amp;mode=init">'.$langs->trans("DoTestSendHTML").'</a>';
724 }
725 }
726
727 print '</div>';
728
729
730 if (getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') == 'mail' && !in_array($action, array('testconnect', 'test', 'testhtml'))) {
731 $text = $langs->trans("WarningPHPMail", $listofmethods['mail'], $listofmethods['smtps']);
732 print info_admin($text);
733 }
734
735 // Run the test to connect
736 if ($action == 'testconnect') {
737 print '<div id="formmailaftertstconnect" name="formmailaftertstconnect"></div>';
738 print load_fiche_titre($langs->trans("DoTestServerAvailability"));
739
740 include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
741 $mail = new CMailFile('', '', '', '', array(), array(), array(), '', '', 0, 0, '', '', '', $trackid, $sendcontext);
742
743 $result = $mail->check_server_port($server, $port);
744 if ($result) {
745 print '<div class="ok">'.$langs->trans("ServerAvailableOnIPOrPort", $server, $port).'</div>';
746 } else {
747 $errormsg = $langs->trans("ServerNotAvailableOnIPOrPort", $server, $port);
748
749 if ($mail->error) {
750 $errormsg .= ' - '.$mail->error;
751 }
752
753 setEventMessages($errormsg, null, 'errors');
754 }
755 print '<br>';
756 }
757
758 // Show email send test form
759 if ($action == 'test' || $action == 'testhtml') {
760 print '<div id="formmailbeforetitle" name="formmailbeforetitle"></div>';
761 print load_fiche_titre($action == 'testhtml' ? $langs->trans("DoTestSendHTML") : $langs->trans("DoTestSend"));
762
763 print dol_get_fiche_head(array(), '', '', -1);
764
765 // Cree l'objet formulaire mail
766 include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
767 $formmail = new FormMail($db);
768 $formmail->fromname = (GETPOSTISSET('fromname') ? GETPOST('fromname', 'restricthtml') : getDolGlobalString('MAIN_MAIL_EMAIL_FROM'));
769 $formmail->frommail = (GETPOSTISSET('frommail') ? GETPOST('frommail', 'restricthtml') : getDolGlobalString('MAIN_MAIL_EMAIL_FROM'));
770 $formmail->trackid = (($action == 'testhtml') ? "testhtml" : "test");
771 $formmail->fromid = $user->id;
772 $formmail->fromalsorobot = 1;
773 $formmail->withfromreadonly = 0;
774 $formmail->withsubstit = 0;
775 $formmail->withfrom = 1;
776 $formmail->witherrorsto = 1;
777 $formmail->withto = (GETPOSTISSET('sendto') ? GETPOST('sendto', 'restricthtml') : ($user->email ? $user->email : 1));
778 $formmail->withtocc = (GETPOSTISSET('sendtocc') ? GETPOST('sendtocc', 'restricthtml') : 1);
779 $formmail->withtoccc = (GETPOSTISSET('sendtoccc') ? GETPOST('sendtoccc', 'restricthtml') : 1);
780 $formmail->withtopic = (GETPOSTISSET('subject') ? GETPOST('subject') : $langs->trans("Test"));
781 $formmail->withtopicreadonly = 0;
782 $formmail->withfile = 2;
783 $formmail->withbody = (GETPOSTISSET('message') ? GETPOST('message', 'restricthtml') : ($action == 'testhtml' ? $langs->transnoentities("PredefinedMailTestHtml") : $langs->transnoentities("PredefinedMailTest")));
784 $formmail->withbodyreadonly = 0;
785 $formmail->withcancel = 1;
786 $formmail->withdeliveryreceipt = 1;
787 $formmail->withfckeditor = ($action == 'testhtml' ? 1 : 0);
788 $formmail->ckeditortoolbar = 'dolibarr_mailings';
789 // Tableau des substitutions
790 $formmail->substit = $substitutionarrayfortest;
791 // Tableau des parameters complementaires du post
792 $formmail->param["action"] = "send";
793 $formmail->param["models"] = "body";
794 $formmail->param["mailid"] = 0;
795 $formmail->param["returnurl"] = $_SERVER["PHP_SELF"];
796
797 // Init list of files
798 if (GETPOST("mode", "aZ09") == 'init') {
799 $formmail->clear_attached_files();
800 }
801
802 print $formmail->get_form('addfile', 'removefile');
803
804 print dol_get_fiche_end();
805 }
806}
807
808// End of page
809llxFooter();
810$db->close();
$id
Definition account.php:48
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 information.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:71
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.
Class permettant la generation du formulaire html d'envoi de mail unitaire Usage: $formail = new Form...
llxFooter()
Footer empty.
Definition document.php:107
print $script_file $mode $langs defaultlang(is_numeric($duration_value) ? " delay=". $duration_value :"").(is_numeric($duration_value2) ? " after cd cd cd description as p label as s rowid as s nom as s email
Sender: Who sends the email ("Sender" has sent emails on behalf of "From").
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
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 a Dolibarr global constant int value.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
yn($yesno, $format=1, $color=0)
Return yes or no in current language.
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.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='')
Show information in HTML for admin users or standard users.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.