EmailController.php 461 B

123456789101112131415161718192021
  1. <?php
  2. namespace App\Http\Controllers;
  3. use Illuminate\Http\Request;
  4. use Mail;
  5. use App\Mail\SendMail;
  6. class EmailController extends Controller
  7. {
  8. public static function index($title,$body)
  9. {
  10. $mailData = [
  11. 'title' => $title,
  12. 'body' => $body,
  13. ];
  14. Mail::to('alexis@bureau-telecoms.fr')->send(new SendMail($mailData));
  15. session()->flash('status', 'Envoyé avec succès');
  16. redirect('/');
  17. }
  18. }