我正在触发一个事件,当他请求重置密码时会向用户发送电子邮件。
这是发送电子邮件的事件监听器 class SendResetPasswordLink {
public function handle(UserForgotPassword $event) {
Mail::to($event->user)
->queue(new SendResetPasswordToken($event->user->passwordResetToken));
}
}
这是我的邮件课程:
class SendResetPasswordToken extends Mailable {
use Queueable, SerializesModels;
public $token;
public function __construct(PasswordReset $token) {
$this->token = $token;
}
public function build() {
return $this->subject('Reset your MyEngine password')
->markdown('emails.password.reset')
->text('emails.password.reset_text');
}
}
我有
提供的电子邮件文件(包括html和文本)resources/views/emails/password/reset.blade.php
和
resources/views/emails/password/reset_text.blade.php
它无效,我收到以下错误:
"View [] not found. (View: /home/vagrant/Laravel/youtube/resources/views/emails/password/reset.blade.php)"
我需要做什么?我的所有刀片文件都已到位。
这是我的reset.blade.php
@component('mail::message')
<strong>Hello {{ $token->user->getFirstNameOrUserName() }}!</strong>
You are receiving this email because we received a password reset request for your account.
If you did not request a password reset, no further action is required.
@component('mail::button', [
'url' => route('password.reset', ['token' => $token,]) . '?email=' . urlencode($token->user->email)
])
Reset Password
@endcomponent
Thanks,<br>
{{ config('app.name') }}
@endcomponent
<hr>
If you’re having trouble clicking the <strong>"Reset Password"</strong> button, copy and paste the URL below into your web browser:<br>
<small>{{ route('password.reset', ['token' => $token,]) . '?email=' . urlencode($token->user->email) }}</small>
@endcomponent
答案 0 :(得分:2)
我找到了答案,
无论出于何种原因,我已经关闭(结束)降价组件两次@endcomponent
。