Upload via GUI (346 Dateien)
This commit is contained in:
@@ -86,7 +86,19 @@ class SmtpMailer
|
||||
STREAM_CLIENT_CONNECT, stream_context_create(['ssl' => ['verify_peer' => true, 'verify_peer_name' => true]])
|
||||
);
|
||||
if (!$this->socket) {
|
||||
throw new \RuntimeException("Verbindung zu {$this->host}:{$this->port} fehlgeschlagen: {$errstr} ({$errno})");
|
||||
// Bei SSL-Fehlern bleibt $errstr oft leer; der eigentliche Grund steht dann in der letzten PHP-Warnung
|
||||
$reason = trim((string) $errstr);
|
||||
if ($reason === '') {
|
||||
$last = (string) (error_get_last()['message'] ?? '');
|
||||
$reason = trim(preg_replace('/^stream_socket_client\(\):\s*/', '', $last));
|
||||
}
|
||||
if ($reason === '') $reason = $this->encryption === 'ssl'
|
||||
? 'keine Antwort. Prüfen, ob Port und Verschlüsselung zusammenpassen (SSL = 465, STARTTLS = 587) und ob der Server ausgehend verbinden darf'
|
||||
: 'keine Antwort (Zeitüberschreitung oder Sperre durch eine Firewall)';
|
||||
if ($this->encryption === 'ssl' && $this->port === 587) $reason .= ' – Port 587 ist für STARTTLS gedacht, bei „SSL/TLS“ gehört Port 465 dazu';
|
||||
elseif ($this->encryption === 'tls' && $this->port === 465) $reason .= ' – Port 465 ist für SSL/TLS gedacht, bei „STARTTLS“ gehört Port 587 dazu';
|
||||
elseif (stripos($reason, 'certificate') !== false || stripos($reason, 'verify') !== false) $reason .= ' – möglicherweise fehlt auf diesem Server die Liste vertrauenswürdiger Zertifizierungsstellen (CA-Bundle: curl.cainfo/openssl.cafile in der PHP-Konfiguration)';
|
||||
throw new \RuntimeException("Verbindung zu {$this->host}:{$this->port} fehlgeschlagen: {$reason}" . ($errno ? " ({$errno})" : ''));
|
||||
}
|
||||
stream_set_timeout($this->socket, $this->timeout);
|
||||
$this->readResponse([220]);
|
||||
|
||||
Reference in New Issue
Block a user