How to fix sending email twice on every request (laravel 7.0)
In laravel version 7, many programmers may face a problem that two emails are sent on every single request. To overcome this issue, we can use redirect instead of return statement.
public function send_email(){
...
...
Mail::to(['test@test.com'])->send(new ForgotPasswordMail($data));
return redirect('/email_sent');
}
public function email_sent(){
return response("Success", 200)
->header('Content-Type', 'Application/json');
}