1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2025-02-21 14:00:53 +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); $mail = new Mail($id_record);
if (!empty((array)$mail)){
if ($mail->testSMTP()) { if ($mail->testSMTP()) {
$_SESSION['infos'][] = tr('Connessione SMTP riuscita'); $_SESSION['infos'][] = tr('Connessione SMTP riuscita');
} else { } else {
$_SESSION['errors'][] = tr('Connessione SMTP non riuscita'); $_SESSION['errors'][] = tr('Connessione SMTP non riuscita');
} }
}else{
$_SESSION['errors'][] = tr('Errore.');
}
break; break;

View File

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