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

Looking for a reliable and skilled web developer? I'm Bhawesh Bhaskar, a Senior Full Stack Software Developer with proven expertise in both front-end and back-end development. I provide professional website design, custom web application development, and robust PHP solutions using Laravel, CodeIgniter, and Core PHP. I help businesses create modern, responsive, and high-performance websites that drive results. Whether you're starting from scratch or need to upgrade your existing site, I deliver solutions tailored to your goals.
💼 Let’s build something great together — contact me today for a free consultation!