laravel mail send example

Example 1: laravel mail create

php artisan make:mail OrderShipped --markdown=emails.orders.shipped

Example 2: send multiple mail in laravel

$emails = ['[email protected]', '[email protected]','[email protected]'];

Mail::send('emails.welcome', [], function($message) use ($emails)
{    
    $message->to($emails)->subject('This is test e-mail');    
});
var_dump( Mail:: failures());
exit;

Example 3: laravel mail to specific email with name

$to = [
    [
        'email' => $email, 
        'name' => $name,
    ]
];
\Mail::to($to)->send(new \App\Mail\Hello);

Example 4: laravel mailable from

return (new Mail)
    ->to('[email protected]')
    ->from('[email protected]');