lundi 9 décembre 2019

In laravel mail not sending it's showing errors

I have created a custom registration form and I am sending confirmation mail but it's showing an error

error

Process could not be started [The system cannot find the path specified.
] 

controller

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;
use App\Http\Controllers\Controller;
use App\Contact;
use App\Student;
use App\Center;
use Illuminate\Support\Str;

use App\Mail\WelcomeMail;
use Illuminate\Support\Facades\Mail;
class MainpageController extends Controller
{

public function franchise_registration(Request $request)

    { 

      $this->validate($request, [


          'center_name' => 'required|string|max:255',
          'center_head' => 'required|string|max:255',
          'contact_no' => 'required|string|max:255',
          'email' => 'required|string|max:255',

        ]);



       $input['center_code']  ="KA_SIIT/".time();
       $input['center_name'] = strtoupper ($request['center_name']);
       $input['center_head'] = strtoupper ($request['center_head']);
       $input['contact_no'] = $request->contact_no;
       $input['email'] = $request->email; 

Center::create($input);

Mail::to($input['email'])->send(new WelcomeMail($input));
return redirect('franchise')->with('success','YOUR REGISTRATION SUCCESSFULLY. .');
   } 
} 

class WelcomeMail extends Mailable { use Queueable, SerializesModels; public $user; /** * Create a new message instance. * * @return void */ public function __construct($user) { $this->user = $user; } /** * Build the message. * * @return $this */ public function build() { return $this->view('emails.confirmation'); } }

Mails confirmation view

<!DOCTYPE html>
<html>
<head>
    <title>Welcome Email</title>
</head>

<body>
<h2>Welcome to the site </h2>
<br/>
Your registered email-id is 
</body>

</html>

Mail drive

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=*********
MAIL_PASSWORD=**********
MAIL_ENCRYPTION=null


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire