Email Laravel 5.6

<?php namespace App\Http\Controllers\User; use Illuminate\Http\Request; use App\Http\Controllers\Controller; use App\User; use Illuminate\Support\Facades\Auth; use Validator; use Mail; class SendMassEmailController extends Controller { public function SendMassEmail(Request $request){ $ListOFEmails=DB::select('select email from users');// this is the selected query return all emails subscriber or whatever foreach($ListOFEmails as $Email){ Mail::raw("Write What Ever you Wanna write", function ($message){ $message->from('yourgmailmail@gmail.com','The Highlight address'); $message->to($Email)->subject("what subject you wanna"); }); } return response()->json([ 'Success'=> true, 'Message'=>'16', 'Data' => null, ], 200); } } }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.