I can make email verification using default template from Laravel 5.8.
Now, I want to customize the email.
Can you help me?
I tried to follow instructions from this: https://medium.com/@lordgape/custom-verification-email-notification-laravel-5-8-573ba3183ead. There is no error, but no email sent.
When I switch back to default verification, the default email is sent.
Edit:
The steps I tried so far:
- Create a mailable for email verification.
- Create views for new email template
- override toMailUsing() using the following code in AppServiceProvider.php:
VerifyEmail::toMailUsing(function ($notifiable){
$verifyUrl = URL::temporarySignedRoute(
'verification.verify',
Carbon::now()->addMinutes(Config::get('auth.verification.expire', 60)),
['id' => $notifiable->getKey()]
);
// dd($notifiable);
return new EmailVerification($verifyUrl, $notifiable);
});
- edit mailable, add two variable: $verifyUrl and $user.
- edit __construct function:
public function __construct($url, User $user)
{
$this->user = $user;
$this->verifyUrl = $url;
}
- edit build() function in mailable, add return $this->view('emails.verifyUser'); (views of custom template).
- No error, "please verify your email" page is shown like usual. But no email sent.