.env
(YOUR-NAME)(YOUR-PASSWORD)を適宜書き換えてください。
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=YOUR-NAME@gmail.com
MAIL_PASSWORD=【gmail2段階認証のアプリパスワード】
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=YOUR-NAME@gmail.com
MAIL_FROM_NAME=デフォルトサイト名
gmail2段階認証のアプリパスワード は通常のログインパスワードとは別に作成する必要があります。
https://myaccount.google.com/security
コントローラー
// テキストメール送信
$mail_subject = "メールのタイトルテスト";
$mail_content = "メールの本文です\nテスト";
$to_email = "customer@user.com";
\Mail::send([], [], function($message) use ($from_email, $from_name, $mail_subject, $mail_content, $to_email ) {
$message->to( $to_email );
$message->subject( $mail_subject );
$message->setBody($mail_content);
});