実現したいこと
お問い合わせフォームの作成をしていまして、そこでviewに関するエラーが発生をしました。
そのエラーの原因を知りたいのと、解決をしたいです。
発生している問題・エラーメッセージ
View [contact.mail] not found.
該当のソースコード
ContactController
1<?php 2 3namespace App\Mail; 4 5use Illuminate\Bus\Queueable; 6use Illuminate\Contracts\Queue\ShouldQueue; 7use Illuminate\Mail\Mailable; 8use Illuminate\Mail\Mailables\Content; 9use Illuminate\Mail\Mailables\Envelope; 10use Illuminate\Queue\SerializesModels; 11 12class ContactSendmail extends Mailable 13{ 14 use Queueable, SerializesModels; 15 16 private $email; 17 private $title; 18 private $body; 19 20 /** 21 * Create a new message instance. 22 * 23 * @return void 24 */ 25 public function __construct( $inputs ) 26 { 27 $this->email = $inputs['email']; 28 $this->title = $inputs['title']; 29 $this->body = $inputs['body']; 30 } 31 32 /** 33 * Build the message. 34 * 35 * @return $this 36 */ 37 public function build() 38 { 39 return $this 40 ->from('example@gmail.com') 41 ->subject('自動送信メール') 42 ->view('contact.mail') 43 ->with([ 44 'email' => $this->email, 45 'title' => $this->title, 46 'body' => $this->body, 47 ]); 48 } 49}
Views/Contacts/mail.blade.php
1お問い合わせ内容を受け付けました。<br> 2<br> 3■メールアドレス<br> 4{!! $email !!}<br> 5<br> 6■タイトル<br> 7{!! $title !!}<br> 8<br> 9■お問い合わせ内容<br> 10{!! nl2br($body) !!}<br>
試したこと
[contacts.mail]に変えたりもしてみたのですが、解決しませんでした。
おかしな点を探しているのですが、まだ分かっていません。
補足情報(FW/ツールのバージョンなど)
PHP8
Laravel10

0 コメント