YouTube Icon

Code Playground.

How to send email using Laravel

CFG

How to send email using Laravel

Use the disguise of mail to send mail through the process of delivery. The method of sending requires three parameters. First parameter is your view blade file where you write your messages, second parameter is to view array data and last parameter is a closure callback that receives a message instance where you can configure the topics, recipients and other features of mail messages.

Code

$inputs = Request::all();

$user_data = [
                "firstname"=>$inputs['first_name'],
                "middlename"=>$inputs['middle_name'],
                "lastname"=>$inputs['last_name'],
                "email"=>$inputs['email'],
                "mobile"=>$inputs['mobile_no'],
                "address"=>$inputs['address'],
                "city"=>$inputs['city'],
                "state"=>$inputs['state'],
                "zipcode"=>$inputs['zipcode'],
                "position"=>$inputs['position'],
        ];


Mail::send('emails.becomeDrOrDrAsst', array("user" => $user_data), function ($message) use ($user_data) 
{
    $message->from('form@gmail.com', 'crowdforgeeks');
    $message->to('demo@gmail.com')->subject('Register Success');
});




CFG