mirror of
https://github.com/mailcow/mailcow-dockerized.git
synced 2026-11-15 21:00:14 +00:00
[Web] Add archive module classes
This commit is contained in:
17 files changed
+1685
No files matched your search
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Mailcow\Archive\Smtp;
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
/**
|
||||
* An SMTP step failed: connect, tls, auth, sender, recipient or data, with the reply of the server.
|
||||
*/
|
||||
class SmtpException extends RuntimeException
|
||||
{
|
||||
private const MAX_TEXT_LENGTH = 200;
|
||||
|
||||
public function __construct(public readonly string $step, public readonly string $reply)
|
||||
{
|
||||
parent::__construct($step . ': ' . $reply);
|
||||
}
|
||||
|
||||
/** Short text for messages: "<step>: <reply>", without angle brackets (the UI escapes message arguments twice) */
|
||||
public function describe(): string
|
||||
{
|
||||
$text = trim((string)preg_replace('/\s+/', ' ', $this->step . ': ' . str_replace(['<', '>'], '', $this->reply)));
|
||||
return mb_substr($text, 0, self::MAX_TEXT_LENGTH);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user