OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Laravel sending email call_user_func() error

  • Thread starter Thread starter Mohan Sharma
  • Start date Start date
M

Mohan Sharma

Guest
I am trying to send email in laravel for which I am using the mail::send function.

This is my code:

Code:
$data = [
          'title'=>'Some Title',
          'content'=>'Content',
          'email'=> 'email',
          'password'=>'password',
          'remarks'=>'remarks'
      ];

      Mail::send('admin.mails.activate', $data, ['user'=>$user], function ($message) use ($user) {
          $message->to($user->email, $user->name)->subject('Account Activation Email')->from('[email protected]');
      });

I am trying to pass the $data variable to the view file and $user variable to the callback function so that I could use user's email to send an email. But it is giving me this error:

Code:
    call_user_func() expects parameter 1 to be a valid callback, array must have exactly two members
<p>I am trying to send email in laravel for which I am using the <code>mail::send</code> function.</p>

<p>This is my code:</p>

<pre><code>$data = [
'title'=>'Some Title',
'content'=>'Content',
'email'=> 'email',
'password'=>'password',
'remarks'=>'remarks'
];

Mail::send('admin.mails.activate', $data, ['user'=>$user], function ($message) use ($user) {
$message->to($user->email, $user->name)->subject('Account Activation Email')->from('[email protected]');
});
</code></pre>

<p>I am trying to pass the $data variable to the view file and $user variable to the callback function so that I could use user's email to send an email. But it is giving me this error:</p>

<pre><code> call_user_func() expects parameter 1 to be a valid callback, array must have exactly two members
</code></pre>
Continue reading...
 

Latest posts

Top