argument('email') ?? env('MAIL_USERNAME') ?? 'gregor@klevze.com'; $body = $this->option('body') ?? "This is a test email sent by php artisan mail:send-test."; try { Mail::to($email)->send(new TestMail($body)); } catch (\Exception $e) { $this->error('Failed to send mail: ' . $e->getMessage()); return 1; } $this->info("Test mail sent to {$email}"); return 0; } }