Bladephp: Now with 8+ codeigniter, php, and laravel project 8+ php project From $37/Month From Rs. 2499/Month

How to send email using Laravel

by
Category:laravel
laravel
How to send email using Laravel

Use Mail facade to send mail via send method. The send method contain three parameters. First parameter is your view blade file where you write your messages, second parameter is for passing array data to view and last one is closure callback that receives a message instance through which you can customize the subjects, 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', 'bladephp');
    $message->to('demo@gmail.com')->subject('Register Success');
});

1 Comments

Alex

15 Mar 2018

Very nice post !!

Html code work in comment box


Related Post