am new to laravel, am trying to send a mail to users if they register successfully and in the email it will contain some details
I my app was creating a new account or the new users but the email wasn't sending, it was displaying this error in the network tab
message: htmlspecialchars() expects parameter 1 to be string, object given (View: C:\xampp\htdocs\laravel Projects\bank\iscbank\resources\views\emails\welcome.blade.php)
here is my code or sending the email
$datty = array(
'name' => $request->input('name'),
'email' => $request->input('email'),
'Authenticationkey' => $this->genAutKey,
'password' => $this->genPass,
'AccountNumber' => $this->AccNum,
);
// Mail::to($request->input('email'))->send(new WelcomeMail($datty));
Mail::send('emails.welcome', ['datty'=>$datty], function ($message) use($datty){
$message->from(Auth::user()->email, Auth::user()->name);
$message->to(Input::get('email'))->subject(Input::get('subject'));
});
Here is my Welcomemail.php code
<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
class WelcomeMail extends Mailable{
use Queueable, SerializesModels;
public $datty;
public function __construct($datty){
$this->datty = $datty;
}
public function build(){
return $this->view('emails.welcome');
}
}
here is my welcome.blade.php code
<div style="background-color: #eeeeef; padding: 50px 0; ">
<div style="max-width:640px; margin:0 auto; ">
<div style="color: #fff; text-align: center; background-color:#33333e; padding: 30px; border-top-left-radius: 3px; border-top-right-radius: 3px; margin: 0;">
<h1>Your account details</h1>
</div>
<div style="padding: 20px; background-color: rgb(255, 255, 255);">
<p style="color: rgb(85, 85, 85); font-size: 14px;">
Hello {{ $datty['name']}},<br>
<br>An account has been created successfully.
</p>
<p style="color: rgb(85, 85, 85); font-size: 14px;">
Please use the following info to login your account:
</p>
<hr>
<p style="color: rgb(85, 85, 85); font-size: 14px;"></p>
<p >
<span style="color: rgb(85, 85, 85); font-size: 14px; line-height: 20px;">
Email: {{ $datty['email'] }}
</span><br>
</p>
<p>
<span style="color: rgb(85, 85, 85); font-size: 14px; line-height: 20px;">
Password: {{ $datty['password'] }}
</span>
</p>
<p>
<span style="color: rgb(85, 85, 85); font-size: 14px; line-height: 20px;">
Activation Key: {{$datty['Authenticationkey']}}
</span>
</p>
<p style="color: rgb(85, 85, 85);"><br></p>
<p style="color: rgb(85, 85, 85); font-size: 14px;">Thanks</p>
</div>
</div>
pls how can i solve this problem, i tried searching online but they are all saying the samething, pls