LoginSignup
1
0

More than 3 years have passed since last update.

laravel6 tinkerを使ってHTMLメールの送信を確認する

Posted at

目的

  • laravelのtinkerからHTMLの送信を行う方法をまとめる。

前提情報

  • gmailを使ったlaravelアプリからのメール送信は下記を参考にメールサーバの設定を実施する。
  • 紹介する内容を実施するとメールサーバの設定がされているとメールが送信されるので注意する。

詳細

  1. laravelアプリ名ディレクトリで下記コマンドを実行してtinkerを開く。

    $ php artisan tinker
    
  2. 下記を実行してメールを送信する。

    Mail::send([], [], function($message) {$message->to('a@example.com')->subject('Test')->setBody("<h1>mail content</h1>", 'text/html');});
    
  3. 下記に実行したPHPのソースのメールに関係ある部分を日本語にして記載する。

    Mail::send([], [], function($message) {$message->to('送信先アドレス')->subject('メールの件名')->setBody("HTMLのタグを含むメール本文", 'text/html');});
    
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0