';
}
// SMTPS oauth service
- if (isset($conf->global->MAIL_SMTP_AUTH_TYPE) && $conf->global->MAIL_SMTP_AUTH_TYPE === "XOAUTH2") {
+ if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps')) && isset($conf->global->MAIN_MAIL_SMTPS_AUTH_TYPE) && $conf->global->MAIN_MAIL_SMTPS_AUTH_TYPE === "XOAUTH2") {
$text = $oauthservices[$conf->global->MAIN_MAIL_SMTPS_OAUTH_SERVICE];
if (empty($text)) {
$text = $langs->trans("Undefined").img_warning();
diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php
index 24c27b47795..de2a44070fc 100644
--- a/htdocs/core/class/CMailFile.class.php
+++ b/htdocs/core/class/CMailFile.class.php
@@ -658,7 +658,7 @@ class CMailFile
}
$keyforsmtpserver = 'MAIN_MAIL_SMTP_SERVER';
- $keyforsmtpuseoauth = "MAIN_MAIL_SMTPS_USE_OAUTH";
+ $keyforsmtpauthtype = "MAIN_MAIL_SMTPS_AUTH_TYPE";
$keyforsmtpoauthservice = "MAIN_MAIL_SMTPS_OAUTH_SERVICE";
$keyforsmtpport = 'MAIN_MAIL_SMTP_PORT';
$keyforsmtpid = 'MAIN_MAIL_SMTPS_ID';
@@ -835,7 +835,7 @@ class CMailFile
$this->smtps->setPW($loginpass);
}
- if (!empty($conf->global->$keyforsmtpuseoauth)) {
+ if (!empty($conf->global->$keyforsmtpauthtype) && $conf->global->$keyforsmtpauthtype === "XOAUTH2") {
require_once DOL_DOCUMENT_ROOT.'/core/lib/oauth.lib.php'; // define $supportedoauth2array
$keyforsupportedoauth2array = $conf->global->$keyforsmtpoauthservice;
if (preg_match('/^.*-/', $keyforsupportedoauth2array)) {
diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php
index 05248e89143..06ada5c4911 100644
--- a/htdocs/core/class/smtps.class.php
+++ b/htdocs/core/class/smtps.class.php
@@ -570,13 +570,13 @@ class SMTPs
}
// Default authentication method is LOGIN
- if (empty($conf->global->MAIL_SMTP_AUTH_TYPE)) {
- $conf->global->MAIL_SMTP_AUTH_TYPE = 'LOGIN';
+ if (empty($conf->global->MAIN_MAIL_SMTPS_AUTH_TYPE)) {
+ $conf->global->MAIN_MAIL_SMTPS_AUTH_TYPE = 'LOGIN';
}
// Send Authentication to Server
// Check for errors along the way
- switch ($conf->global->MAIL_SMTP_AUTH_TYPE) {
+ switch ($conf->global->MAIN_MAIL_SMTPS_AUTH_TYPE) {
case 'NONE':
// Do not send the 'AUTH type' message. For test purpose, if you don't need authentication, it is better to not enter login/pass into setup.
$_retVal = true;
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index e5b8fe597bc..d629bbc0fbf 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -2287,7 +2287,9 @@ NoName=No name
ShowAdvancedOptions= Show advanced options
HideAdvancedoptions= Hide advanced options
CIDLookupURL=The module brings an URL that can be used by an external tool to get the name of a thirdparty or contact from its phone number. URL to use is:
-MAIN_MAIL_SMTPS_USE_OAUTH=Use OAUTH2 authentication
-OauthNotAvailableForAll=OAUTH2 authentication is not available for all hosts
+OauthNotAvailableForAllAndHadToBeCreatedBefore=OAUTH2 authentication is not available for all hosts, and a token with the right permissions must have been created upstream with the OAUTH module
MAIN_MAIL_SMTPS_OAUTH_SERVICE=OAUTH2 authentication service
-DontForgetCreateTokenOauthMod=A token with the right permissions must have been created upstream with the OAUTH module
\ No newline at end of file
+DontForgetCreateTokenOauthMod=A token with the right permissions must have been created upstream with the OAUTH module
+MAIN_MAIL_SMTPS_AUTH_TYPE=Authentification method
+UsePassword=Use a password
+UseOauth=Use a OAUTH token
\ No newline at end of file
diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang
index 6302377b449..42d973e8e06 100644
--- a/htdocs/langs/fr_FR/admin.lang
+++ b/htdocs/langs/fr_FR/admin.lang
@@ -2287,7 +2287,9 @@ ShowAdvancedOptions= Show advanced options
HideAdvancedoptions= Hide advanced options
CIDLookupURL=The module brings an URL that can be used by an external tool to get the name of a thirdparty or contact from its phone number. URL to use is:
DoesNotWorkWithAllThemes=Ne fonctionne pas avec tous les thèmes
-MAIN_MAIL_SMTPS_USE_OAUTH=Utilisation de l'authentification OAUTH2
-OauthNotAvailableForAll=L'authentification OAUTH2 n'est pas disponible pour tous les hôtes
+OauthNotAvailableForAllAndHadToBeCreatedBefore=L'authentification OAUTH2 n'est pas disponible pour tous les hôtes, de plus, un jeton avec les bonnes permissions doit avoir été créé en amont avec le module OAUTH
MAIN_MAIL_SMTPS_OAUTH_SERVICE=Service d'authentification OAUTH2
DontForgetCreateTokenOauthMod=Un jeton avec les bonnes permissions doit avoir été créé en amont avec le module OAUTH
+MAIN_MAIL_SMTPS_AUTH_TYPE=Méthode d'authentication
+UsePassword=Utiliser un mot de pass
+UseOauth=Utiliser un jeton d'authentification OAUTH
\ No newline at end of file