
Step:1 open git base in C:\xampp\htdocs

Step:2 past this project name in the gitbase here
composer create-project –prefer-dist laravel/laravel multimail “5.8.*”
Step:3 Make One controller
php artisan make:controller MultimailController
Step:4 php artisan make:mail Multimail
Step:5 resources\views\Multimail.blade.php
paste this code in Multimail.blade.php
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>Multi Mail using laravel 5.8</title> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css"> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script> | |
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js"></script> | |
</head> | |
<body> | |
<div class="container"> | |
<div class="row"> | |
<div class="col-2"></div> | |
<div class="col-8"> | |
@if(session()->get('success')) | |
<div class="alert alert-success mt-2"> | |
<button type="button" class="close" data-dismiss="alert">×</button> | |
{{ session()->get('success') }} | |
</div> | |
@endif | |
<div class="card"> | |
<div class="card-header"> | |
Multimail send using laravel 5.8 | |
</div> | |
<div class="card-body"> | |
<form method="post" action="{{url('multimail/send')}}" enctype="multipart/form-data"> | |
{{ csrf_field() }} | |
<label> Email Id </label> | |
<textarea type="email" class="w-100 p-2" placeholder="Enter Email Id" name="email" value=" {{old('email')}}"> </textarea> | |
<label>Enter Your Message</label> | |
<textarea type="text" name="message" class="w-100 p-2" placeholder="Enter your Message" value="{{old('message')}}"></textarea> | |
<button type="submit" name="send" class="btn btn-primary fa fa-send-o"> Submit </button> | |
</form> | |
</div> | |
</div> | |
</div> | |
<div class="col-2"></div> | |
</div> | |
</div> | |
</body> | |
</html> |

Step:6 app\Http\Controllers\MultimailController.php
paste this code in Multimailcontroller.php
<?php | |
namespace App\Http\Controllers; | |
use Illuminate\Http\Request; | |
use App\Mail\Multimail; | |
use Illuminate\Support\Facades\Mail; | |
class MultimailController extends Controller | |
{ | |
public function index(){ | |
return view('Multimail'); | |
} | |
public function send(Request $request) | |
{ | |
$this->validate($request, [ | |
'email' => 'required', | |
'message' => 'required', | |
]); | |
$admin_email = $request->email; | |
$multimail = (explode(",",$admin_email)); | |
for($count = 0; $count < count($multimail); $count++) | |
{ | |
$data[] = array( | |
'message' => $request->message, | |
'email' => $multimail[$count] ); } | |
foreach($data as $d){ | |
$demail = $d['email']; | |
Mail::to($demail)->send(new Multimail($d)); | |
} | |
return redirect('multimail')->with('success', 'Mail has been sent successfully!'); | |
} | |
} | |
Step:7 routes\web.php
paste this code in web.php
Route::get('multimail','MultimailController@index'); | |
Route::post('multimail/send', 'MultimailController@send'); |

Step:8 app\Mail\Multimail.php
paste this code in Multimail.php
<?php | |
namespace App\Mail; | |
use Illuminate\Bus\Queueable; | |
use Illuminate\Mail\Mailable; | |
use Illuminate\Queue\SerializesModels; | |
use Illuminate\Contracts\Queue\ShouldQueue; | |
class Multimail extends Mailable | |
{ | |
use Queueable, SerializesModels; | |
public $d; | |
/** | |
* Create a new message instance. | |
* | |
* @return void | |
*/ | |
public function __construct($d) { | |
$this->d = $d; } | |
public function build() | |
{ | |
return $this->from('info@testing.com') | |
->subject('New Message from DevopsSchool') | |
->view('multi_email_template') | |
->with('d', $this->d); | |
} | |
} |

Step:9 resources\views\multi_email_template.blade.php
paste code in this page multi_email_template.blade.php
<p>Your Message {{ $d['message'] }}.</p> | |
<p>Your email Id {{ $d['email'] }}.</p> |
Step:9 Go mail trap or click here https://mailtrap.io/ and sign up then you will get username, user password,

Step:10 fianally run this code in your gitbase here
php artisan serve

Step:11 copy this url and put in your browser.http://127.0.0.1:8000/multimail

overview how to work controller using send mail.



MotoShare.in is your go-to platform for adventure and exploration. Rent premium bikes for epic journeys or simple scooters for your daily errands—all with the MotoShare.in advantage of affordability and ease.