Skip to content

Commit

Permalink
✨ Show config when running mail:test (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
tombroucke authored Mar 26, 2024
1 parent 3c9ff69 commit 6bd55d7
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Console/Commands/MailTestCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' : "<fg=blue>{$value}</>"));

$this->components->bulletList($config);
});

$recipient = $this->option('to') ?: $this->askForRecipient();
Expand Down

0 comments on commit 6bd55d7

Please sign in to comment.