From 6bd55d7ef677d92ddd6154f684707a51a0e98917 Mon Sep 17 00:00:00 2001 From: tombroucke Date: Tue, 26 Mar 2024 02:15:54 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Show=20config=20when=20running=20`m?= =?UTF-8?q?ail:test`=20(#7)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Console/Commands/MailTestCommand.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Console/Commands/MailTestCommand.php b/src/Console/Commands/MailTestCommand.php index ee553ef..2d4ccce 100644 --- a/src/Console/Commands/MailTestCommand.php +++ b/src/Console/Commands/MailTestCommand.php @@ -47,6 +47,13 @@ public function handle() add_action('phpmailer_init', function ($phpmailer) use ($instance) { $phpmailer->SMTPDebug = 1; $phpmailer->Debugoutput = fn ($error) => $instance->errors[] = $error; + + $config = collect($phpmailer) + ->filter(fn ($value, $key) => in_array($key, ['Host', 'Port', 'Username', 'Password', 'Timeout', 'FromName', 'From', 'Subject'])) + ->map(fn ($value, $key) => $key === 'Password' ? Str::mask($value, '*', 0) : $value) + ->map(fn ($value, $key) => "{$key}: ".((is_null($value) || empty($value)) ? 'Not set' : "{$value}")); + + $this->components->bulletList($config); }); $recipient = $this->option('to') ?: $this->askForRecipient();