|
@@ -52,8 +52,8 @@ $substitutionarrayfortest = array(
|
|
|
'__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" />',
|
|
|
'__USER_LOGIN__' => $user->login,
|
|
|
'__USER_EMAIL__' => $user->email,
|
|
|
- '__USER_SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? $usersignature : ''), // Done into actions_sendmails
|
|
|
- '__SENDEREMAIL_SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? $usersignature : ''), // Done into actions_sendmails
|
|
|
+ '__USER_SIGNATURE__' => (($user->signature && !getDolGlobalString('MAIN_MAIL_DO_NOT_USE_SIGN')) ? $usersignature : ''), // Done into actions_sendmails
|
|
|
+ '__SENDEREMAIL_SIGNATURE__' => (($user->signature && !getDolGlobalString('MAIN_MAIL_DO_NOT_USE_SIGN')) ? $usersignature : ''), // Done into actions_sendmails
|
|
|
'__ID__' => 'RecipientIdRecord',
|
|
|
//'__EMAIL__' => 'RecipientEMail', // Done into actions_sendmails
|
|
|
'__LOGIN__' => $user->login,
|
|
@@ -162,14 +162,14 @@ if (preg_match('/^mac/i', PHP_OS)) {
|
|
|
$linuxlike = 0;
|
|
|
}
|
|
|
|
|
|
-if (empty($conf->global->MAIN_MAIL_SENDMODE)) {
|
|
|
+if (!getDolGlobalString('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 = getDolGlobalString('MAIN_MAIL_SMTP_PORT') ? $conf->global->MAIN_MAIL_SMTP_PORT : ini_get('smtp_port');
|
|
|
if (!$port) {
|
|
|
$port = 25;
|
|
|
}
|
|
|
-$server = !empty($conf->global->MAIN_MAIL_SMTP_SERVER) ? $conf->global->MAIN_MAIL_SMTP_SERVER : ini_get('SMTP');
|
|
|
+$server = getDolGlobalString('MAIN_MAIL_SMTP_SERVER') ? $conf->global->MAIN_MAIL_SMTP_SERVER : ini_get('SMTP');
|
|
|
if (!$server) {
|
|
|
$server = '127.0.0.1';
|
|
|
}
|
|
@@ -369,7 +369,7 @@ if ($action == 'edit') {
|
|
|
|
|
|
// Force e-mail recipient
|
|
|
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_FORCE_SENDTO").'</td><td>';
|
|
|
- print '<input class="flat" name="MAIN_MAIL_FORCE_SENDTO" size="32" value="'.(!empty($conf->global->MAIN_MAIL_FORCE_SENDTO) ? $conf->global->MAIN_MAIL_FORCE_SENDTO : '').'" />';
|
|
|
+ print '<input class="flat" name="MAIN_MAIL_FORCE_SENDTO" size="32" value="'.(getDolGlobalString('MAIN_MAIL_FORCE_SENDTO') ? $conf->global->MAIN_MAIL_FORCE_SENDTO : '').'" />';
|
|
|
print '</td></tr>';
|
|
|
|
|
|
print '</table>';
|
|
@@ -406,7 +406,7 @@ if ($action == 'edit') {
|
|
|
print '</td>';
|
|
|
} else {
|
|
|
print '<td>';
|
|
|
- $mainserver = (!empty($conf->global->MAIN_MAIL_SMTP_SERVER) ? $conf->global->MAIN_MAIL_SMTP_SERVER : '');
|
|
|
+ $mainserver = (getDolGlobalString('MAIN_MAIL_SMTP_SERVER') ? $conf->global->MAIN_MAIL_SMTP_SERVER : '');
|
|
|
$smtpserver = ini_get('SMTP') ?ini_get('SMTP') : $langs->transnoentities("Undefined");
|
|
|
if ($linuxlike) {
|
|
|
print $langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike");
|
|
@@ -437,7 +437,7 @@ if ($action == 'edit') {
|
|
|
print '</td><td>';
|
|
|
print '<span class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
|
|
|
} else {
|
|
|
- $mainport = (!empty($conf->global->MAIN_MAIL_SMTP_PORT) ? $conf->global->MAIN_MAIL_SMTP_PORT : '');
|
|
|
+ $mainport = (getDolGlobalString('MAIN_MAIL_SMTP_PORT') ? $conf->global->MAIN_MAIL_SMTP_PORT : '');
|
|
|
$smtpport = ini_get('smtp_port') ?ini_get('smtp_port') : $langs->transnoentities("Undefined");
|
|
|
if ($linuxlike) {
|
|
|
print $langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike");
|
|
@@ -480,7 +480,7 @@ if ($action == 'edit') {
|
|
|
|
|
|
// ID
|
|
|
if (!empty($conf->use_javascript_ajax) || (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail'), array('smtps', 'swiftmailer')))) {
|
|
|
- $mainstmpid = (!empty($conf->global->MAIN_MAIL_SMTPS_ID) ? $conf->global->MAIN_MAIL_SMTPS_ID : '');
|
|
|
+ $mainstmpid = (getDolGlobalString('MAIN_MAIL_SMTPS_ID') ? $conf->global->MAIN_MAIL_SMTPS_ID : '');
|
|
|
print '<tr class="drag drop oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTPS_ID").'</td><td>';
|
|
|
// SuperAdministrator access only
|
|
|
if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
|
|
@@ -496,7 +496,7 @@ if ($action == 'edit') {
|
|
|
|
|
|
// PW
|
|
|
if (!empty($conf->use_javascript_ajax) || (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail'), array('smtps', 'swiftmailer')))) {
|
|
|
- $mainsmtppw = (!empty($conf->global->MAIN_MAIL_SMTPS_PW) ? $conf->global->MAIN_MAIL_SMTPS_PW : '');
|
|
|
+ $mainsmtppw = (getDolGlobalString('MAIN_MAIL_SMTPS_PW') ? $conf->global->MAIN_MAIL_SMTPS_PW : '');
|
|
|
print '<tr class="drag drop oddeven smtp_pw"><td>';
|
|
|
print $form->textwithpicto($langs->trans("MAIN_MAIL_SMTPS_PW"), $langs->trans("WithGMailYouCanCreateADedicatedPassword"));
|
|
|
print '</td><td>';
|
|
@@ -533,7 +533,7 @@ if ($action == 'edit') {
|
|
|
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_TLS").'</td><td>';
|
|
|
if (!empty($conf->use_javascript_ajax) || (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail'), array('smtps', 'swiftmailer')))) {
|
|
|
if (function_exists('openssl_open')) {
|
|
|
- print $form->selectyesno('MAIN_MAIL_EMAIL_TLS', (!empty($conf->global->MAIN_MAIL_EMAIL_TLS) ? $conf->global->MAIN_MAIL_EMAIL_TLS : 0), 1);
|
|
|
+ print $form->selectyesno('MAIN_MAIL_EMAIL_TLS', (getDolGlobalString('MAIN_MAIL_EMAIL_TLS') ? $conf->global->MAIN_MAIL_EMAIL_TLS : 0), 1);
|
|
|
} else {
|
|
|
print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
|
|
|
}
|
|
@@ -546,7 +546,7 @@ if ($action == 'edit') {
|
|
|
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").'</td><td>';
|
|
|
if (!empty($conf->use_javascript_ajax) || (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail'), array('smtps', 'swiftmailer')))) {
|
|
|
if (function_exists('openssl_open')) {
|
|
|
- print $form->selectyesno('MAIN_MAIL_EMAIL_STARTTLS', (!empty($conf->global->MAIN_MAIL_EMAIL_STARTTLS) ? $conf->global->MAIN_MAIL_EMAIL_STARTTLS : 0), 1);
|
|
|
+ print $form->selectyesno('MAIN_MAIL_EMAIL_STARTTLS', (getDolGlobalString('MAIN_MAIL_EMAIL_STARTTLS') ? $conf->global->MAIN_MAIL_EMAIL_STARTTLS : 0), 1);
|
|
|
} else {
|
|
|
print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
|
|
|
}
|
|
@@ -559,7 +559,7 @@ if ($action == 'edit') {
|
|
|
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").'</td><td>';
|
|
|
if (!empty($conf->use_javascript_ajax) || (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail'), array('smtps', 'swiftmailer')))) {
|
|
|
if (function_exists('openssl_open')) {
|
|
|
- print $form->selectyesno('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED', (!empty($conf->global->MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED) ? $conf->global->MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED : 0), 1);
|
|
|
+ print $form->selectyesno('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED', (getDolGlobalString('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED') ? $conf->global->MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED : 0), 1);
|
|
|
} else {
|
|
|
print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
|
|
|
}
|
|
@@ -572,7 +572,7 @@ if ($action == 'edit') {
|
|
|
print '<tr class="oddeven dkim"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_ENABLED").'</td><td>';
|
|
|
if (!empty($conf->use_javascript_ajax) || (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail'), array('swiftmailer')))) {
|
|
|
if (function_exists('openssl_open')) {
|
|
|
- print $form->selectyesno('MAIN_MAIL_EMAIL_DKIM_ENABLED', (!empty($conf->global->MAIN_MAIL_EMAIL_DKIM_ENABLED) ? $conf->global->MAIN_MAIL_EMAIL_DKIM_ENABLED : 0), 1);
|
|
|
+ print $form->selectyesno('MAIN_MAIL_EMAIL_DKIM_ENABLED', (getDolGlobalString('MAIN_MAIL_EMAIL_DKIM_ENABLED') ? $conf->global->MAIN_MAIL_EMAIL_DKIM_ENABLED : 0), 1);
|
|
|
} else {
|
|
|
print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
|
|
|
}
|
|
@@ -583,17 +583,17 @@ if ($action == 'edit') {
|
|
|
|
|
|
// DKIM Domain
|
|
|
print '<tr class="oddeven dkim"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_DOMAIN").'</td>';
|
|
|
- print '<td><input class="flat" id="MAIN_MAIL_EMAIL_DKIM_DOMAIN" name="MAIN_MAIL_EMAIL_DKIM_DOMAIN" size="32" value="'.(!empty($conf->global->MAIN_MAIL_EMAIL_DKIM_DOMAIN) ? $conf->global->MAIN_MAIL_EMAIL_DKIM_DOMAIN : '');
|
|
|
+ print '<td><input class="flat" id="MAIN_MAIL_EMAIL_DKIM_DOMAIN" name="MAIN_MAIL_EMAIL_DKIM_DOMAIN" size="32" value="'.(getDolGlobalString('MAIN_MAIL_EMAIL_DKIM_DOMAIN') ? $conf->global->MAIN_MAIL_EMAIL_DKIM_DOMAIN : '');
|
|
|
print '"></td></tr>';
|
|
|
|
|
|
// DKIM Selector
|
|
|
print '<tr class="oddeven dkim"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_SELECTOR").'</td>';
|
|
|
- print '<td><input class="flat" id="MAIN_MAIL_EMAIL_DKIM_SELECTOR" name="MAIN_MAIL_EMAIL_DKIM_SELECTOR" size="32" value="'.(!empty($conf->global->MAIN_MAIL_EMAIL_DKIM_SELECTOR) ? $conf->global->MAIN_MAIL_EMAIL_DKIM_SELECTOR : '');
|
|
|
+ print '<td><input class="flat" id="MAIN_MAIL_EMAIL_DKIM_SELECTOR" name="MAIN_MAIL_EMAIL_DKIM_SELECTOR" size="32" value="'.(getDolGlobalString('MAIN_MAIL_EMAIL_DKIM_SELECTOR') ? $conf->global->MAIN_MAIL_EMAIL_DKIM_SELECTOR : '');
|
|
|
print '"></td></tr>';
|
|
|
|
|
|
// DKIM PRIVATE KEY
|
|
|
print '<tr class="oddeven dkim"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY").'</td>';
|
|
|
- print '<td><textarea id="MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY" name="MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY" rows="15" cols="100">'.(!empty($conf->global->MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY) ? $conf->global->MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY : '').'</textarea>';
|
|
|
+ print '<td><textarea id="MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY" name="MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY" rows="15" cols="100">'.(getDolGlobalString('MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY') ? $conf->global->MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY : '').'</textarea>';
|
|
|
print '</td></tr>';
|
|
|
|
|
|
print '</table>';
|
|
@@ -606,13 +606,13 @@ if ($action == 'edit') {
|
|
|
// From
|
|
|
$help = img_help(1, $langs->trans("EMailHelpMsgSPFDKIM"));
|
|
|
print '<tr class="oddeven"><td class="fieldrequired">'.$langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from') ?ini_get('sendmail_from') : $langs->transnoentities("Undefined")).' '.$help.'</td>';
|
|
|
- print '<td><input class="flat minwidth200" name="MAIN_MAIL_EMAIL_FROM" value="'.(!empty($conf->global->MAIN_MAIL_EMAIL_FROM) ? $conf->global->MAIN_MAIL_EMAIL_FROM : '');
|
|
|
+ print '<td><input class="flat minwidth200" name="MAIN_MAIL_EMAIL_FROM" value="'.(getDolGlobalString('MAIN_MAIL_EMAIL_FROM') ? $conf->global->MAIN_MAIL_EMAIL_FROM : '');
|
|
|
print '"></td></tr>';
|
|
|
|
|
|
// Default from type
|
|
|
$liste = array();
|
|
|
$liste['user'] = $langs->trans('UserEmail');
|
|
|
- $liste['company'] = $langs->trans('CompanyEmail').' ('.(empty($conf->global->MAIN_INFO_SOCIETE_MAIL) ? $langs->trans("NotDefined") : $conf->global->MAIN_INFO_SOCIETE_MAIL).')';
|
|
|
+ $liste['company'] = $langs->trans('CompanyEmail').' ('.(!getDolGlobalString('MAIN_INFO_SOCIETE_MAIL') ? $langs->trans("NotDefined") : $conf->global->MAIN_INFO_SOCIETE_MAIL).')';
|
|
|
|
|
|
print '<tr class="oddeven"><td>'.$langs->trans('MAIN_MAIL_DEFAULT_FROMTYPE').'</td><td>';
|
|
|
print $form->selectarray('MAIN_MAIL_DEFAULT_FROMTYPE', $liste, getDolGlobalString('MAIN_MAIL_DEFAULT_FROMTYPE'), 0);
|
|
@@ -620,12 +620,12 @@ if ($action == 'edit') {
|
|
|
|
|
|
// From
|
|
|
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_ERRORS_TO").'</td>';
|
|
|
- print '<td><input class="flat" name="MAIN_MAIL_ERRORS_TO" size="32" value="'.(!empty($conf->global->MAIN_MAIL_ERRORS_TO) ? $conf->global->MAIN_MAIL_ERRORS_TO : '');
|
|
|
+ print '<td><input class="flat" name="MAIN_MAIL_ERRORS_TO" size="32" value="'.(getDolGlobalString('MAIN_MAIL_ERRORS_TO') ? $conf->global->MAIN_MAIL_ERRORS_TO : '');
|
|
|
print '"></td></tr>';
|
|
|
|
|
|
// Autocopy to
|
|
|
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_AUTOCOPY_TO").'</td>';
|
|
|
- print '<td><input class="flat" name="MAIN_MAIL_AUTOCOPY_TO" size="32" value="'.(!empty($conf->global->MAIN_MAIL_AUTOCOPY_TO) ? $conf->global->MAIN_MAIL_AUTOCOPY_TO : '');
|
|
|
+ print '<td><input class="flat" name="MAIN_MAIL_AUTOCOPY_TO" size="32" value="'.(getDolGlobalString('MAIN_MAIL_AUTOCOPY_TO') ? $conf->global->MAIN_MAIL_AUTOCOPY_TO : '');
|
|
|
print '"></td></tr>';
|
|
|
|
|
|
// Add user to select destinaries list
|
|
@@ -655,13 +655,13 @@ if ($action == 'edit') {
|
|
|
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
|
|
|
|
|
// Disable
|
|
|
- print '<tr class="oddeven"><td>'.$langs->trans("MAIN_DISABLE_ALL_MAILS").'</td><td>'.yn(!empty($conf->global->MAIN_DISABLE_ALL_MAILS));
|
|
|
- if (!empty($conf->global->MAIN_DISABLE_ALL_MAILS)) {
|
|
|
+ print '<tr class="oddeven"><td>'.$langs->trans("MAIN_DISABLE_ALL_MAILS").'</td><td>'.yn(getDolGlobalString('MAIN_DISABLE_ALL_MAILS'));
|
|
|
+ if (getDolGlobalString('MAIN_DISABLE_ALL_MAILS')) {
|
|
|
print img_warning($langs->trans("Disabled"));
|
|
|
}
|
|
|
print '</td></tr>';
|
|
|
|
|
|
- if (empty($conf->global->MAIN_DISABLE_ALL_MAILS)) {
|
|
|
+ if (!getDolGlobalString('MAIN_DISABLE_ALL_MAILS')) {
|
|
|
// Force e-mail recipient
|
|
|
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_FORCE_SENDTO").'</td><td>'.getDolGlobalString('MAIN_MAIL_FORCE_SENDTO');
|
|
|
if (getDolGlobalString('MAIN_MAIL_FORCE_SENDTO')) {
|
|
@@ -677,7 +677,7 @@ if ($action == 'edit') {
|
|
|
print '</table>';
|
|
|
print '</div>';
|
|
|
|
|
|
- if (empty($conf->global->MAIN_DISABLE_ALL_MAILS)) {
|
|
|
+ if (!getDolGlobalString('MAIN_DISABLE_ALL_MAILS')) {
|
|
|
print '<br>';
|
|
|
|
|
|
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
|
|
@@ -692,7 +692,7 @@ if ($action == 'edit') {
|
|
|
}
|
|
|
print $text;
|
|
|
|
|
|
- if (getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail') == 'mail' && empty($conf->global->MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP)) {
|
|
|
+ if (getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail') == 'mail' && !getDolGlobalString('MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP')) {
|
|
|
$textwarning = $langs->trans("WarningPHPMail").'<br>'.$langs->trans("WarningPHPMailA").'<br>'.$langs->trans("WarningPHPMailB").'<br>'.$langs->trans("WarningPHPMailC").'<br><br>'.$langs->trans("WarningPHPMailD");
|
|
|
print $form->textwithpicto('', '<span class="small">'.$textwarning.'</span>', 1, 'warning');
|
|
|
}
|
|
@@ -703,7 +703,7 @@ if ($action == 'edit') {
|
|
|
if ($linuxlike && (getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail') == 'mail')) {
|
|
|
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike").'</td><td><span class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span></td></tr>';
|
|
|
} else {
|
|
|
- print '<tr class="oddeven"><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) ? $conf->global->MAIN_MAIL_SMTP_SERVER : '').'</td></tr>';
|
|
|
+ print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTP_SERVER", ini_get('SMTP') ?ini_get('SMTP') : $langs->transnoentities("Undefined")).'</td><td>'.(getDolGlobalString('MAIN_MAIL_SMTP_SERVER') ? $conf->global->MAIN_MAIL_SMTP_SERVER : '').'</td></tr>';
|
|
|
}
|
|
|
|
|
|
|
|
@@ -711,7 +711,7 @@ if ($action == 'edit') {
|
|
|
if ($linuxlike && (getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail') == 'mail')) {
|
|
|
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike").'</td><td><span class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span></td></tr>';
|
|
|
} else {
|
|
|
- print '<tr class="oddeven"><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) ? $conf->global->MAIN_MAIL_SMTP_PORT : '').'</td></tr>';
|
|
|
+ print '<tr class="oddeven"><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') ? $conf->global->MAIN_MAIL_SMTP_PORT : '').'</td></tr>';
|
|
|
}
|
|
|
|
|
|
// AUTH method
|
|
@@ -813,7 +813,7 @@ if ($action == 'edit') {
|
|
|
print '</table>';
|
|
|
print '</div>';
|
|
|
|
|
|
- if (getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail') == 'mail' && empty($conf->global->MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP)) {
|
|
|
+ if (getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail') == 'mail' && !getDolGlobalString('MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP')) {
|
|
|
$messagetoshow = $langs->trans("WarningPHPMail").'<br>'.$langs->trans("WarningPHPMailA").'<br>'.$langs->trans("WarningPHPMailB").'<br>'.$langs->trans("WarningPHPMailC").'<br><br>'.$langs->trans("WarningPHPMailD");
|
|
|
$messagetoshow .= ' '.$langs->trans("WarningPHPMailDbis", '{s1}', '{s2}');
|
|
|
$linktosetvar1 = '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=disablephpmailwarning&token='.newToken().'">';
|
|
@@ -833,7 +833,7 @@ if ($action == 'edit') {
|
|
|
$help = img_help(1, $langs->trans("EMailHelpMsgSPFDKIM"));
|
|
|
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from') ?ini_get('sendmail_from') : $langs->transnoentities("Undefined")).' '.$help.'</td>';
|
|
|
print '<td>' . getDolGlobalString('MAIN_MAIL_EMAIL_FROM');
|
|
|
- if (empty($conf->global->MAIN_MAIL_EMAIL_FROM)) {
|
|
|
+ if (!getDolGlobalString('MAIN_MAIL_EMAIL_FROM')) {
|
|
|
print img_warning($langs->trans("Mandatory"));
|
|
|
} elseif (!isValidEmail($conf->global->MAIN_MAIL_EMAIL_FROM)) {
|
|
|
print img_warning($langs->trans("ErrorBadEMail"));
|
|
@@ -843,7 +843,7 @@ if ($action == 'edit') {
|
|
|
// Default from type
|
|
|
$liste = array();
|
|
|
$liste['user'] = $langs->trans('UserEmail');
|
|
|
- $liste['company'] = $langs->trans('CompanyEmail').' ('.(empty($conf->global->MAIN_INFO_SOCIETE_MAIL) ? $langs->trans("NotDefined") : $conf->global->MAIN_INFO_SOCIETE_MAIL).')';
|
|
|
+ $liste['company'] = $langs->trans('CompanyEmail').' ('.(!getDolGlobalString('MAIN_INFO_SOCIETE_MAIL') ? $langs->trans("NotDefined") : $conf->global->MAIN_INFO_SOCIETE_MAIL).')';
|
|
|
$sql = 'SELECT rowid, label, email FROM '.MAIN_DB_PREFIX.'c_email_senderprofile';
|
|
|
$sql .= ' WHERE active = 1 AND (private = 0 OR private = '.((int) $user->id).')';
|
|
|
$resql = $db->query($sql);
|
|
@@ -883,7 +883,7 @@ if ($action == 'edit') {
|
|
|
// Errors To
|
|
|
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_ERRORS_TO").'</td>';
|
|
|
print '<td>'.(getDolGlobalString('MAIN_MAIL_ERRORS_TO'));
|
|
|
- if (!empty($conf->global->MAIN_MAIL_ERRORS_TO) && !isValidEmail($conf->global->MAIN_MAIL_ERRORS_TO)) {
|
|
|
+ if (getDolGlobalString('MAIN_MAIL_ERRORS_TO') && !isValidEmail($conf->global->MAIN_MAIL_ERRORS_TO)) {
|
|
|
print img_warning($langs->trans("ErrorBadEMail"));
|
|
|
}
|
|
|
print '</td></tr>';
|
|
@@ -891,7 +891,7 @@ if ($action == 'edit') {
|
|
|
// Autocopy to
|
|
|
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_AUTOCOPY_TO").'</td>';
|
|
|
print '<td>';
|
|
|
- if (!empty($conf->global->MAIN_MAIL_AUTOCOPY_TO)) {
|
|
|
+ if (getDolGlobalString('MAIN_MAIL_AUTOCOPY_TO')) {
|
|
|
$listofemail = explode(',', $conf->global->MAIN_MAIL_AUTOCOPY_TO);
|
|
|
$i = 0;
|
|
|
foreach ($listofemail as $key => $val) {
|
|
@@ -911,9 +911,9 @@ if ($action == 'edit') {
|
|
|
print '</td></tr>';
|
|
|
|
|
|
//Add user to select destinaries list
|
|
|
- print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_ENABLED_USER_DEST_SELECT").'</td><td>'.yn(!empty($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT)).'</td></tr>';
|
|
|
+ print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_ENABLED_USER_DEST_SELECT").'</td><td>'.yn(getDolGlobalString('MAIN_MAIL_ENABLED_USER_DEST_SELECT')).'</td></tr>';
|
|
|
//Disable autoselect to
|
|
|
- print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_NO_WITH_TO_SELECTED").'</td><td>'.yn(!empty($conf->global->MAIN_MAIL_NO_WITH_TO_SELECTED)).'</td></tr>';
|
|
|
+ print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_NO_WITH_TO_SELECTED").'</td><td>'.yn(getDolGlobalString('MAIN_MAIL_NO_WITH_TO_SELECTED')).'</td></tr>';
|
|
|
|
|
|
print '</table>';
|
|
|
print '</div>';
|
|
@@ -927,7 +927,7 @@ if ($action == 'edit') {
|
|
|
|
|
|
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'">'.$langs->trans("Modify").'</a>';
|
|
|
|
|
|
- if (empty($conf->global->MAIN_DISABLE_ALL_MAILS)) {
|
|
|
+ if (!getDolGlobalString('MAIN_DISABLE_ALL_MAILS')) {
|
|
|
if (getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail') != 'mail' || !$linuxlike) {
|
|
|
if (function_exists('fsockopen') && $port && $server) {
|
|
|
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=testconnect&date='.dol_now().'#formmailaftertstconnect">'.$langs->trans("DoTestServerAvailability").'</a>';
|
|
@@ -946,7 +946,7 @@ if ($action == 'edit') {
|
|
|
print '</div>';
|
|
|
|
|
|
|
|
|
- if (getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail') == 'mail' && empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA)) {
|
|
|
+ if (getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail') == 'mail' && !getDolGlobalString('MAIN_FIX_FOR_BUGGED_MTA')) {
|
|
|
/*
|
|
|
// Warning 1
|
|
|
if ($linuxlike)
|
|
@@ -968,23 +968,23 @@ if ($action == 'edit') {
|
|
|
}
|
|
|
|
|
|
if (getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail') == 'mail') {
|
|
|
- if (!empty($conf->global->MAIN_EXTERNAL_MAIL_SPF_STRING_TO_ADD)) {
|
|
|
+ if (getDolGlobalString('MAIN_EXTERNAL_MAIL_SPF_STRING_TO_ADD')) {
|
|
|
// List of string to add in SPF if the setup use the mail method. Example 'include:sendgrid.net include:spf.mydomain.com'
|
|
|
$text .= ($text ? '<br><br>' : '').'<!-- MAIN_EXTERNAL_MAIL_SPF_STRING_TO_ADD -->'.$langs->trans("WarningPHPMailSPF", $conf->global->MAIN_EXTERNAL_MAIL_SPF_STRING_TO_ADD);
|
|
|
} else {
|
|
|
// MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS is list of IPs where email is sent from. Example: '1.2.3.4, [aaaa:bbbb:cccc:dddd]'.
|
|
|
- if (!empty($conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS)) {
|
|
|
+ if (getDolGlobalString('MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS')) {
|
|
|
// List of IP show as record to add in SPF if we use the mail method
|
|
|
$text .= ($text ? '<br><br>' : '').'<!-- MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS -->'.$langs->trans("WarningPHPMailSPF", $conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS);
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
- if (!empty($conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS)) {
|
|
|
+ if (getDolGlobalString('MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS')) {
|
|
|
// List of IP show as record to add as allowed IP if we use the smtp method. Value is '1.2.3.4, [aaaa:bbbb:cccc:dddd]'
|
|
|
// TODO Add a key to allow to show the IP/name of server detected dynamically
|
|
|
$text .= ($text ? '<br><br>' : '').'<!-- MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS -->'.$langs->trans("WarningPHPMail2", $conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS);
|
|
|
}
|
|
|
- if (!empty($conf->global->MAIN_EXTERNAL_SMTP_SPF_STRING_TO_ADD)) { // Should be required only if you have preset the Dolibarr to use your own SMTP and you want to warn users to update their domain name to match your SMTP server.
|
|
|
+ if (getDolGlobalString('MAIN_EXTERNAL_SMTP_SPF_STRING_TO_ADD')) { // Should be required only if you have preset the Dolibarr to use your own SMTP and you want to warn users to update their domain name to match your SMTP server.
|
|
|
// List of string to add in SPF if we use the smtp method. Example 'include:spf.mydomain.com'
|
|
|
$text .= ($text ? '<br><br>' : '').'<!-- MAIN_EXTERNAL_SMTP_SPF_STRING_TO_ADD -->'.$langs->trans("WarningPHPMailSPF", $conf->global->MAIN_EXTERNAL_SMTP_SPF_STRING_TO_ADD);
|
|
|
}
|
|
@@ -1047,7 +1047,7 @@ if ($action == 'edit') {
|
|
|
$formmail->frommail = (GETPOSTISSET('frommail') ? GETPOST('frommail') : $conf->global->MAIN_MAIL_EMAIL_FROM);
|
|
|
$formmail->fromid = $user->id;
|
|
|
$formmail->fromalsorobot = 1;
|
|
|
- $formmail->fromtype = (GETPOSTISSET('fromtype') ?GETPOST('fromtype', 'aZ09') : (!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE) ? $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE : 'user'));
|
|
|
+ $formmail->fromtype = (GETPOSTISSET('fromtype') ?GETPOST('fromtype', 'aZ09') : (getDolGlobalString('MAIN_MAIL_DEFAULT_FROMTYPE') ? $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE : 'user'));
|
|
|
$formmail->withfromreadonly = 1;
|
|
|
$formmail->withsubstit = 1;
|
|
|
$formmail->withfrom = 1;
|