';
@@ -997,7 +1007,6 @@ if ($action == 'edit') {
print '';
-
if (getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail') == 'mail' && !getDolGlobalString('MAIN_FIX_FOR_BUGGED_MTA')) {
/*
// Warning 1
@@ -1013,7 +1022,7 @@ if ($action == 'edit') {
print info_admin($langs->trans("SendmailOptionMayHurtBuggedMTA"));
}
- if (!in_array($action, array('testconnect', 'test', 'testhtml'))) {
+ if (!in_array($action, array('testconnect', 'test', 'testhtml')) && !getDolGlobalString('MAIN_DISABLE_ALL_MAILS')) {
$text = '';
if (getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail') == 'mail') {
//$text .= $langs->trans("WarningPHPMail"); // To encourage to use SMTPS
@@ -1132,8 +1141,10 @@ if ($action == 'edit') {
$formmail->withtopic = (GETPOSTISSET('subject') ? GETPOST('subject') : $langs->trans("Test"));
$formmail->withtopicreadonly = 0;
$formmail->withfile = 2;
- $formmail->withlayout = 1; // Not MAIN_EMAIL_USE_LAYOUT must be set
- $formmail->withaiprompt = ($action == 'testhtml' ? 'html' : 'text');
+
+ $formmail->withlayout = 1; // Note: MAIN_EMAIL_USE_LAYOUT must be set
+ $formmail->withaiprompt = ($action == 'testhtml' ? 'html' : 'text'); // Note: Module AI must be enabled
+
$formmail->withbody = (GETPOSTISSET('message') ? GETPOST('message', 'restricthtml') : ($action == 'testhtml' ? $langs->transnoentities("PredefinedMailTestHtml") : $langs->transnoentities("PredefinedMailTest")));
$formmail->withbodyreadonly = 0;
$formmail->withcancel = 1;
diff --git a/htdocs/admin/mails_emailing.php b/htdocs/admin/mails_emailing.php
index e25dc10f210..024d07537aa 100644
--- a/htdocs/admin/mails_emailing.php
+++ b/htdocs/admin/mails_emailing.php
@@ -41,20 +41,20 @@ if ($action == 'test' || $action == 'send') {
}
$substitutionarrayfortest = array(
- '__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT,
- '__CHECK_READ__' => ' ',
+ '__ID__' => 'RecipientIdRecord',
'__USER_LOGIN__' => $user->login,
'__USER_EMAIL__' => $user->email,
'__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
'__LASTNAME__' => 'RecipientLastname',
'__FIRSTNAME__' => 'RecipientFirstname',
'__ADDRESS__'=> 'RecipientAddress',
'__ZIP__'=> 'RecipientZip',
'__TOWN_'=> 'RecipientTown',
- '__COUNTRY__'=> 'RecipientCountry'
+ '__COUNTRY__'=> 'RecipientCountry',
+ '__DOL_MAIN_URL_ROOT__' => DOL_MAIN_URL_ROOT,
+ '__CHECK_READ__' => ' '
);
complete_substitutions_array($substitutionarrayfortest, $langs);
@@ -139,11 +139,11 @@ if (preg_match('/^mac/i', PHP_OS)) {
if (!getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING')) {
$conf->global->MAIN_MAIL_SENDMODE_EMAILING = 'default';
}
-$port = getDolGlobalString('MAIN_MAIL_SMTP_PORT_EMAILING') ? $conf->global->MAIN_MAIL_SMTP_PORT_EMAILING : ini_get('smtp_port');
+$port = getDolGlobalInt('MAIN_MAIL_SMTP_PORT_EMAILING', ini_get('smtp_port'));
if (!$port) {
$port = 25;
}
-$server = getDolGlobalString('MAIN_MAIL_SMTP_SERVER_EMAILING') ? $conf->global->MAIN_MAIL_SMTP_SERVER_EMAILING : ini_get('SMTP');
+$server = getDolGlobalString('MAIN_MAIL_SMTP_SERVER_EMAILING', ini_get('SMTP'));
if (!$server) {
$server = '127.0.0.1';
}
@@ -200,7 +200,13 @@ if ($action == 'edit') {
jQuery("#MAIN_MAIL_EMAIL_STARTTLS_EMAILING").prop("disabled", true);
jQuery("#MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING").val(0);
jQuery("#MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING").prop("disabled", true);
- jQuery(".smtp_method").hide();
+ jQuery("#MAIN_MAIL_EMAIL_DKIM_ENABLED_EMAILING").val(0);
+ jQuery("#MAIN_MAIL_EMAIL_DKIM_ENABLED_EMAILING").prop("disabled", true);
+ jQuery("#MAIN_MAIL_EMAIL_DKIM_DOMAIN_EMAILING").prop("disabled", true);
+ jQuery("#MAIN_MAIL_EMAIL_DKIM_SELECTOR_EMAILING").prop("disabled", true);
+ jQuery("#MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY_EMAILING").prop("disabled", true);
+ jQuery(".smtp_method").hide();
+ jQuery(".dkim").hide();
jQuery(".smtp_auth_method").hide();
';
if ($linuxlike) {
@@ -230,6 +236,14 @@ if ($action == 'edit') {
jQuery("#MAIN_MAIL_EMAIL_STARTTLS_EMAILING").removeAttr("disabled");
jQuery("#MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING").val(' . getDolGlobalString('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING').');
jQuery("#MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING").removeAttr("disabled");
+ jQuery("#MAIN_MAIL_EMAIL_DKIM_ENABLED_EMAILING").val(0);
+ jQuery("#MAIN_MAIL_EMAIL_DKIM_ENABLED_EMAILING").prop("disabled", true);
+ jQuery("#MAIN_MAIL_EMAIL_DKIM_DOMAIN_EMAILING").prop("disabled", true);
+ jQuery("#MAIN_MAIL_EMAIL_DKIM_SELECTOR_EMAILING").prop("disabled", true);
+ jQuery("#MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY_EMAILING").prop("disabled", true);
+ jQuery("#MAIN_MAIL_EMAIL_DKIM_DOMAIN_EMAILING").hide();
+ jQuery("#MAIN_MAIL_EMAIL_DKIM_SELECTOR_EMAILING").hide();
+ jQuery("#MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY_EMAILING").hide();
jQuery("#MAIN_MAIL_SMTP_SERVER_EMAILING").removeAttr("disabled");
jQuery("#MAIN_MAIL_SMTP_PORT_EMAILING").removeAttr("disabled");
jQuery("#MAIN_MAIL_SMTP_SERVER_EMAILING").show();
@@ -237,6 +251,7 @@ if ($action == 'edit') {
jQuery("#smtp_port_mess").hide();
jQuery("#smtp_server_mess").hide();
jQuery(".smtp_method").show();
+ jQuery(".dkim").hide();
jQuery(".smtp_auth_method").show();
}
if (jQuery("#MAIN_MAIL_SENDMODE_EMAILING").val()==\'swiftmailer\')
@@ -249,6 +264,14 @@ if ($action == 'edit') {
jQuery("#MAIN_MAIL_EMAIL_STARTTLS_EMAILING").removeAttr("disabled");
jQuery("#MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING").val(' . getDolGlobalString('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING').');
jQuery("#MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING").removeAttr("disabled");
+ jQuery("#MAIN_MAIL_EMAIL_DKIM_ENABLED_EMAILING").val(0);
+ jQuery("#MAIN_MAIL_EMAIL_DKIM_ENABLED_EMAILING").prop("disabled", true);
+ jQuery("#MAIN_MAIL_EMAIL_DKIM_DOMAIN_EMAILING").prop("disabled", true);
+ jQuery("#MAIN_MAIL_EMAIL_DKIM_SELECTOR_EMAILING").prop("disabled", true);
+ jQuery("#MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY_EMAILING").prop("disabled", true);
+ jQuery("#MAIN_MAIL_EMAIL_DKIM_DOMAIN_EMAILING").hide();
+ jQuery("#MAIN_MAIL_EMAIL_DKIM_SELECTOR_EMAILING").hide();
+ jQuery("#MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY_EMAILING").hide();
jQuery("#MAIN_MAIL_SMTP_SERVER_EMAILING").removeAttr("disabled");
jQuery("#MAIN_MAIL_SMTP_PORT_EMAILING").removeAttr("disabled");
jQuery("#MAIN_MAIL_SMTP_SERVER_EMAILING").show();
@@ -256,22 +279,30 @@ if ($action == 'edit') {
jQuery("#smtp_server_mess").hide();
jQuery("#smtp_port_mess").hide();
jQuery(".smtp_method").show();
+ jQuery(".dkim").show();
jQuery(".smtp_auth_method").show();
}
}
function change_smtp_auth_method() {
console.log("Call smtp auth method");
- if (jQuery("#MAIN_MAIL_SENDMODE_EMAILING").val()==\'smtps\' && jQuery("#radio_oauth").prop("checked")) {
- jQuery(".smtp_pw").hide();
- jQuery(".smtp_oauth_service").show();
- } else if (jQuery("#MAIN_MAIL_SENDMODE_EMAILING").val()==\'swiftmailer\' && jQuery("#radio_oauth").prop("checked")) {
- jQuery(".smtp_pw").hide();
- jQuery(".smtp_oauth_service").show();
- } else if(jQuery("#MAIN_MAIL_SENDMODE_EMAILING").val()==\'mail\'){
- jQuery(".smtp_pw").hide();
- jQuery(".smtp_oauth_service").hide();
+ if (jQuery("#MAIN_MAIL_SENDMODE_EMAILING").val()==\'smtps\') {
+ if (jQuery("#radio_oauth").prop("checked")) {
+ jQuery(".smtp_pw").hide();
+ jQuery(".smtp_oauth_service").show();
+ } else {
+ jQuery(".smtp_pw").show();
+ jQuery(".smtp_oauth_service").hide();
+ }
+ } else if (jQuery("#MAIN_MAIL_SENDMODE_EMAILING").val()==\'swiftmailer\') {
+ if (jQuery("#radio_oauth").prop("checked")) {
+ jQuery(".smtp_pw").hide();
+ jQuery(".smtp_oauth_service").show();
+ } else {
+ jQuery(".smtp_pw").show();
+ jQuery(".smtp_oauth_service").hide();
+ }
} else {
- jQuery(".smtp_pw").show();
+ jQuery(".smtp_pw").hide();
jQuery(".smtp_oauth_service").hide();
}
}
@@ -593,7 +624,7 @@ if ($action == 'edit') {
if (empty($text)) {
$text = $langs->trans("Undefined").img_warning();
}
- print ' |