Missing argument 1 for Illuminate \ Support \ Manager :: createDriver () when sending mail to laravel

My .env file is:

MAIL_DRIVER=mail MAIL_HOST=smtp.mandrillapp.com MAIL_PORT=587 MAIL_USERNAME=sabin.maharjan456@gmail.com MAIL_PASSWORD=**************************** 

Mailer.php

  <?php namespace App\Http\Controllers; class Mailer{ public function sendTo($email, $subject, $view, $data = array()) { \Mail::queue($view, $data, function($message) use($email, $subject) { $message->to($email)->subject($subject); }); return "Mail has been sent"; } public function welcome($formData) { $subject = "User Message was arrived !"; $data['name'] = $formData['name']; $data['email'] = $formData['email']; $data['mobile'] = $formData['mobile']; $data['subject'] = $formData['subject']; $data['bodymessage'] = $formData['message']; $view = 'emails.welcome'; return $this->sendTo([' sabin.maharjan456@gmail.com '],$subject,$view,$data); } } 

Controller or:

  public function postContactFormRequest(CreateContactFormRequest $request,Mailer $mailer) { $formData = $request->all(); $this->mailer->welcome($formData); } 

view file:

  <!DOCTYPE html> <html lang="en-US"> <head> <meta charset="utf-8"> </head> <body> <h2>User Message</h2> <p><b>Email Address:</b> {{ $email }}</p> <h4>User Name : {{ $name }}</h4> <p> Phone Number :{{ $mobile}}</p> <p>Message :{{ $bodymessage }} </p> </body> </html> 

this is my file: I get a continuous error while trying to send an email.

Argument 1 is missing for Illuminate \ Support \ Manager :: createDriver (), is called in / home / robustit / public _html / nic-website / vendor / laravel / framework / src / Illuminate / Support / Manager.php on line 89 and is defined

+5
source share
1 answer

I have had problems with this so far.

You want to check your .env file and make sure your database parameters are correct, but also you want:

CACHE_DRIVER=file SESSION_DRIVER=file QUEUE_DRIVER=sync

For some reason, I got these empty fields. And then it worked for me!

-1
source

Source: https://habr.com/ru/post/1235604/


All Articles