Van1310
256
5
Laravel

Argument 1 passed to Illuminate\Mail\PendingMail::queue() must be an instance of Illuminate\Mail\Mailable, array given, called in

Posted 1 month ago by Van1310

i try to send mail in laravel 5.7 using queue then also use array value to send mail so then print error like

Argument 1 passed to Illuminate\Mail\PendingMail::queue() must be an instance of Illuminate\Mail\Mailable, array given, called in C:\laragon\www\bulk_emailer\app\Http\Controllers\MailController.php on line 24

so to fix it please help me out !

here is my controller code

public function sendmail(Request $request){
    // return $request;
    $email = $request->get('to');
    // return $email;
    $data = [
        'subject' => $request->subject,
        'message' => $request->message,
        'files' => $request->files,
    ];

    \Mail::to($email)->queue(new Mailer($data));
}

Please sign in or create an account to participate in this conversation.