laravel mail success or failure

Solutions on MaxInterview for laravel mail success or failure by the best coders in the world

showing results for - "laravel mail success or failure"
Antonio
22 Jan 2018
1/**
2 *  Send Mail from Parts Specification Form
3 */
4public function sendMail(Request $request) {
5    $data = $request->all();
6
7    $messageBody = $this->getMessageBody($data);
8
9    Mail::raw($messageBody, function ($message) {
10        $message->from('yourEmail@domain.com', 'Learning Laravel');
11        $message->to('goper.zosa@gmail.com');
12        $message->subject('Learning Laravel test email');
13    });
14
15    // check for failures
16    if (Mail::failures()) {
17        // return response showing failed emails
18    }
19
20    // otherwise everything is okay ...
21    return redirect()->back();
22}
23