1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2025-02-16 19:40:44 +01:00

Fix per test connessione al server SMTP

This commit is contained in:
Luca 2018-07-25 12:00:49 +02:00
parent c11c5f0fa5
commit 6315861a07
2 changed files with 17 additions and 9 deletions

View File

@ -66,11 +66,15 @@ switch (post('op')) {
}
$mail = new Mail($id_record);
if ($mail->testSMTP()) {
$_SESSION['infos'][] = tr('Connessione SMTP riuscita');
} else {
$_SESSION['errors'][] = tr('Connessione SMTP non riuscita');
}
if (!empty((array)$mail)){
if ($mail->testSMTP()) {
$_SESSION['infos'][] = tr('Connessione SMTP riuscita');
} else {
$_SESSION['errors'][] = tr('Connessione SMTP non riuscita');
}
}else{
$_SESSION['errors'][] = tr('Errore.');
}
break;

View File

@ -224,15 +224,19 @@ class Mail extends PHPMailer\PHPMailer\PHPMailer
return $result;
}
/**
* Testa la connessione al server SMTP
*
* @return boolean
*/
public function testSMTP()
{
if ($this->IsSMTP() && $this->smtpConnect()) {
if ($this->smtpConnect()) {
$this->smtpClose();
return true;
}
return false;
}
}