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')]
|
2026-10-06 15:55:02 +02:00
|
|
|
#[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');
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|