Send email in laravel

Email in laravel can be send using SMTP.

Email in laravel can be send using SMTP.


    use Illuminate\Support\Facades\Mail;
                
    $details = Model::where('id', $id)->first();
    
    $datamail = array();            
    $datamail['firstname'] = $details->first_name;
    $datamail['lastname'] = $details->last_name;
    $datamail['email'] = $details->email;
    $datamail['phone'] = $details->phone;
    
    $datamail['admin_email'] = 'johndoe@gmail.com';
        
    Mail::send('emails.templatename', $datamail, function ($message) use ($datamail) {
        $message->from('noreply@domainname.com', 'Domain Name'); 
        $message->to($datamail['admin_email']);
        $message->cc(['name1@domainname.com','name2@domainname.com']);
        $message->subject('Email Subject Here.');
    });

0 Comment's

Add Comment

Register to Reply

About Author

I am Bhawesh Bhaskar, a Full Stack Sr. Software Developer. I am a good learner and always eager to learn new technologies. I can develop both client and server software. In addition to mastering HTML and CSS, I also know how to: Program a browser (like using JavaScript, jQuery) Program a server (like using Laravel, Code Ignitor or Core PHP).