ldc-boutique-cnc-sable/app/Console/Commands/MailTest.php

33 lines
852 B
PHP
Raw Permalink Normal View History

2026-06-14 21:32:07 +02:00
<?php
declare(strict_types=1);
namespace App\Console\Commands;
use Illuminate\Console\Attributes\Description;
use Illuminate\Console\Attributes\Signature;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Validator;
#[Description('Send a test mail')]
#[Signature('uwil:app:mail-test
2026-06-14 21:32:07 +02:00
{email : the email to send the test mail to}')]
class MailTest extends Command
{
/**
* Execute the console command.
*/
public function handle(): void
{
Validator::make($this->arguments(), [
'email' => ['required', 'email:rfc,strict'],
])->validate();
Mail::raw('This is a test mail', function ($message): void {
$message->to($this->argument('email'));
$message->subject('Test mail');
});
}
}