N°5102 - Allow to send emails using GSuite SMTP and OAuth - Rework

This commit is contained in:
Eric Espie
2022-06-21 15:06:12 +02:00
parent ec86bd246a
commit 3f326f0913
4 changed files with 7 additions and 4 deletions

View File

@@ -138,11 +138,12 @@ function CheckEmailSetting($oP)
$sDisplayUserName = empty($sUserName) ? '<em>no user</em> ' : $sUserName;
try {
$oRemoteAuthentOAuth = OAuthClientProviderFactory::GetRemoteAuthentOAuthForSMTP();
$sLink = MetaModel::GetHyperLink(get_class($oRemoteAuthentOAuth), $oRemoteAuthentOAuth->GetKey());
$oP->info("The connection used is: $sLink");
$sProvider = $oRemoteAuthentOAuth->Get('provider');
$sDisplayProvider = empty($sProvider) ? '<em>no Provider</em> ' : $sProvider;
$sClientID = $oRemoteAuthentOAuth->Get('client_id');
$sDisplayClientID = empty($sClientID) ? '<em>no password</em> ' : $sClientID;
$oP->info("SMTP configuration (from config-itop.php): host: $sHost, port: $sPort, provider: $sDisplayProvider, user: $sDisplayUserName, client id: $sDisplayClientID, encryption: $sDisplayEncryption.");
$oP->info("SMTP configuration (from config-itop.php): host: $sHost, port: $sPort, provider: $sDisplayProvider, user: $sDisplayUserName, encryption: $sDisplayEncryption.");
if (($sHost == 'localhost') && ($sPort == '25') && ($sUserName == '') && ($sClientID == '') && ($sProvider == '')) {
$oP->warning("The default settings may not be suitable for your environment. You may want to adjust these values by editing iTop's configuration file (".utils::GetConfigFilePathRelative().').');
}