jeudi 19 décembre 2019

Showing undefined variable: sendemail Laravel Beautymail

I cant send the email. It's showing undefined variable if I am putting "$sendemail = $insert->email;", but if I am putting email manually like "biswanath123@gmail.com" this one is working perfectly. How to fix it?

use Snowfire\Beautymail\Beautymail;

function email($id)
{
    $insert = Clientdetail::find($id);
    $sendemail = $insert->email;

    $data = [
        'name' => $insert->name,
        'email' => $insert->email,
        'phone' => $insert->phone,
        'city' => $insert->city,
        'insurance' => $insert->insurance,
        'policyno' => $insert->policyno,
        'amount' => $insert->amount,
        'pdffile' => 'http://localhost/Bitu/insurancewebsite/'.$insert->filepath
    ];

    $beautymail = app()->make(Beautymail::class);
    $beautymail->send('emails.Admin.policydetail', ["data1" => $data], function ($message) use ($sendemail) {
        $message->from('babuli.prasad.singh@gmail.com', 'Insurance Website')
            ->to($sendemail, 'Insurance Website');
    });
}


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire