$ composer require guzzlehttp/guzzle
config/mail.php
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'test@hpscript.com'),
'name' => env('MAIL_FROM_NAME', 'Hpscript'),
],
.env
MAIL_MAILER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=${userName}
MAIL_PASSWORD=${password}
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=null
MAIL_FROM_NAME="${APP_NAME}"
$ php artisan make:mail TestMail
app/Mail/TestMail.php
public function build()
{
return $this
->from("test@hpscript")
->subject("test send")
->view('email.test');
}
resources/views/email/test.blade.php
test mail body
$ php artisan make:controller –resource MailController
Route
Route::get('/mail', [App\Http\Controllers\MailController::class, 'index']);
app/Http/Controllers/MailController.php
use Illuminate\Support\Facades\Mail;
use App\Mail\TestMail;
public function index()
{
//
Mail::to('test@example.com')
->send(new TestMail());
}

mailtrapはいいけど、実際に送れないと意味ない。
メール設計書を作成して、mailgunを使っていきます。