changes to sms packages and option to create user

This commit is contained in:
Simon Pocrnjič
2025-11-06 21:54:07 +01:00
parent ad8e0d5cee
commit 1395b72ae8
102 changed files with 1386 additions and 319 deletions
+7 -2
View File
@@ -75,7 +75,8 @@ protected function performSmtpAuthTest(MailProfile $profile): void
}
$remote = ($encryption === 'ssl') ? 'ssl://'.$host : $host;
$errno = 0; $errstr = '';
$errno = 0;
$errstr = '';
$socket = @fsockopen($remote, $port, $errno, $errstr, 15);
if (! $socket) {
throw new \RuntimeException("Connect failed: $errstr ($errno)");
@@ -104,7 +105,9 @@ protected function performSmtpAuthTest(MailProfile $profile): void
// Cleanly quit
$this->command($socket, "QUIT\r\n", [221], 'QUIT');
} finally {
try { fclose($socket); } catch (\Throwable) {
try {
fclose($socket);
} catch (\Throwable) {
// ignore
}
}
@@ -116,6 +119,7 @@ protected function performSmtpAuthTest(MailProfile $profile): void
protected function command($socket, string $cmd, array $expect, string $context): string
{
fwrite($socket, $cmd);
return $this->expect($socket, $expect, $context);
}
@@ -138,6 +142,7 @@ protected function expect($socket, array $expectedCodes, string $context): strin
if (! in_array($code, $expectedCodes, true)) {
throw new \RuntimeException("Unexpected SMTP code $code during $context: ".implode(' | ', $lines));
}
return $line;
}
}