I am working with Laravel 5.4. When I am sending mail from Local server mail is going to the inbox folder working fine, configure file .env following :-
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=email
MAIL_PASSWORD=password
MAIL_ENCRYPTION=tls
After that I shift to live server and I configure the .env file following:->
MAIL_DRIVER=sendmail
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=ssl
mail receive but in spam folder.How to avoid from spam folder.
Here is my Controller function
function createSchool(Request $request){
$this->validator($request->all())->validate();
$user = $this->create($request->all());
if($user){
$mailInformation = $request->all();
if($mailInformation){
Mail::to($request->user())
->cc($mailInformation['email'])
->send(new SchoolRegistration($mailInformation));
}
return redirect('admin/schools')->with('success', 'School added Successfully');
}
}