33 lines
847 B
PHP
33 lines
847 B
PHP
|
|
<?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('app:mail-test
|
||
|
|
{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');
|
||
|
|
});
|
||
|
|
}
|
||
|
|
}
|