Added idea to ask SMTP credentials on AUTH failure

This commit is contained in:
the-djmaze 2024-04-23 15:10:45 +02:00
parent 24dbe4f197
commit 2656d362d6
2 changed files with 97 additions and 61 deletions

View file

@ -157,7 +157,18 @@ trait Messages
public function DoSendMessage() : array
{
$oAccount = $this->initMailClientConnection();
/*
$aAuth = $this->GetActionParam('auth', null);
if ($aAuth) {
$oAccount->setSmtpUser($aAuth['username']);
$oAccount->setSmtpPass(new \SnappyMail\SensitiveString($aAuth['password']));
// if ($oAccount instanceof AdditionalAccount && !empty($aAuth['remember'])) {
// $oMainAccount = $this->getMainAccountFromToken();
// $aAccounts = $this->GetAccounts($oMainAccount);
// $this->SetAccounts($oMainAccount, $aAccounts);
// }
}
*/
$oConfig = $this->Config();
$sSaveFolder = $this->GetActionParam('saveFolder', '');
@ -300,6 +311,10 @@ trait Messages
}
}
}
catch (\MailSo\Smtp\Exceptions\LoginBadCredentialsException $oException)
{
throw new ClientException(Notifications::AuthError, $oException);
}
catch (ClientException $oException)
{
throw $oException;