I'm on trying to implement sending email verification using Laravel 5.1. Before sending, a code is generated and mapped to with URL which the user will click and redirected to the website login page. I got this code and edited it to suit my concern but I'm getting error below:
public function store(UserFormRequest $userFormRequest)
{
$confirmation_code = str_random(30);
$users = new User;
$users->firstname = $userFormRequest->firstname;
$users->lastname = $userFormRequest->lastname;
$users->email = $userFormRequest->email;
$users->username = $userFormRequest->username;
$users->password = $userFormRequest->password;
$users->confirmation_code = $confirmation_code;
Mail::send('email.verify', ['users' => $users, 'confirmation_code' => $confirmation_code ], function ($message) use ($users) {
$message->from('members@schoolproject.com', 'School Project Member');
$message->to($users->email, $users->firstname)->subject('Your Reminder!');
});
Flash::message('Thanks for signing up! Please check your email.');
$users->save();
// return redirect()->route('index');
return redirect()->action('UserController@index');
//return 'test';
}
Verify.blade.php file:
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8">
</head>
<body>
<h2>Verify Your Email Address</h2>
<div>
Thanks for creating an account with the verification demo app.
Please follow the link below to verify your email address
{{ URL::to('register/verify/' . $confirmation_code) }}.<br/>
</div>
</body>
</html>
Error log generated:
Swift_TransportException in AbstractSmtpTransport.php line 383:
Expected response code 250 but got code "530", with message "530 5.7.1 Authentication required
"
in AbstractSmtpTransport.php line 383
at Swift_Transport_AbstractSmtpTransport->_assertResponseCode('530 5.7.1 Authentication required ', array('250')) in AbstractSmtpTransport.php line 281
at Swift_Transport_AbstractSmtpTransport->executeCommand('MAIL FROM:<members@schoolproject.com> ', array('250'), array()) in EsmtpTransport.php line 243
at Swift_Transport_EsmtpTransport->executeCommand('MAIL FROM:<members@schoolproject.com> ', array('250')) in EsmtpTransport.php line 322
at Swift_Transport_EsmtpTransport->_doMailFromCommand('members@schoolproject.com') in AbstractSmtpTransport.php line 416
at Swift_Transport_AbstractSmtpTransport->_doMailTransaction(object(Swift_Message), 'members@schoolproject.com', array('kadeoya@appzonegroup.com'), array()) in AbstractSmtpTransport.php line 444
at Swift_Transport_AbstractSmtpTransport->_sendTo(object(Swift_Message), 'members@schoolproject.com', array('kadeoya@appzonegroup.com' => 'Akehindegbegbon'), array()) in AbstractSmtpTransport.php line 176
at Swift_Transport_AbstractSmtpTransport->send(object(Swift_Message), array()) in Mailer.php line 85
at Swift_Mailer->send(object(Swift_Message), array()) in Mailer.php line 395
at Mailer->sendSwiftMessage(object(Swift_Message)) in Mailer.php line 181
at Mailer->send('email.verify', array('users' => object(User), 'confirmation_code' => '42p7pPHkBVvwF9mSiL7pwWR8UnNfdX'), object(Closure)) in Facade.php line 222
at Facade::__callStatic('send', array('email.verify', array('users' => object(User), 'confirmation_code' => '42p7pPHkBVvwF9mSiL7pwWR8UnNfdX'), object(Closure))) in UserController.php line 60
at Mail::send('email.verify', array('users' => object(User), 'confirmation_code' => '42p7pPHkBVvwF9mSiL7pwWR8UnNfdX'), object(Closure)) in UserController.php line 60
at UserController->store(object(UserFormRequest))
at call_user_func_array(array(object(UserController), 'store'), array(object(UserFormRequest))) in Controller.php line 256
at Controller->callAction('store', array(object(UserFormRequest))) in ControllerDispatcher.php line 164
at ControllerDispatcher->call(object(UserController), object(Route), 'store') in ControllerDispatcher.php line 112
at ControllerDispatcher->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in ControllerDispatcher.php line 114
at ControllerDispatcher->callWithinStack(object(UserController), object(Route), object(Request), 'store') in ControllerDispatcher.php line 69
at ControllerDispatcher->dispatch(object(Route), object(Request), 'App\Http\Controllers\UserController', 'store') in Route.php line 203
at Route->runWithCustomDispatcher(object(Request)) in Route.php line 134
at Route->run(object(Request)) in Router.php line 712
at Router->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in Router.php line 714
at Router->runRouteWithinStack(object(Route), object(Request)) in Router.php line 679
at Router->dispatchToRoute(object(Request)) in Router.php line 639
at Router->dispatch(object(Request)) in Kernel.php line 236
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in VerifyCsrfToken.php line 50
at VerifyCsrfToken->handle(object(Request), object(Closure))
at call_user_func_array(array(object(VerifyCsrfToken), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in ShareErrorsFromSession.php line 49
at ShareErrorsFromSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(ShareErrorsFromSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in StartSession.php line 62
at StartSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(StartSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 37
at AddQueuedCookiesToResponse->handle(object(Request), object(Closure))
at call_user_func_array(array(object(AddQueuedCookiesToResponse), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in EncryptCookies.php line 59
at EncryptCookies->handle(object(Request), object(Closure))
at call_user_func_array(array(object(EncryptCookies), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in CheckForMaintenanceMode.php line 42
at CheckForMaintenanceMode->handle(object(Request), object(Closure))
at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in Kernel.php line 122
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 87
at Kernel->handle(object(Request)) in index.php line 54
at require_once('C:\Users\ken4ward\Documents\xampp\htdocs\schoolproject\public\index.php') in server.php line 21
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire