0

The failures() method is not working. It returns an empty array while sending an invalid email.

Mail::send('mail_templates', $messageData, 
    function ($message) use ($firstname, $email_id) {
        $message->to($email_id, $firstname)
            ->subject('Welcome Mail');
});

$a = Mail::failures();

return $a;

I checked the from email address.

Address not found

The notification occurred in FROM EMAIL and the mail failure response shows an empty array ([]). I want to know if the email is sent or not while the API calls to mail send process in Laravel.

Karl Hill
  • 12,937
  • 5
  • 58
  • 95
manoji
  • 3
  • 1
  • 4

1 Answers1

0

Possible duplicate of this Question How the laravel Mail::failures() function works?.

Better refer above Stackoverflow link In that link there is an answer related to this.. specially read alexrussell comment.

It's worth nothing that only very specific types of failures are retuned from Swiftmailer: pretty much only failures in the sense that the method used for mail rejected the address/email. With SMTP this is generally okay, as SMTP servers will immediately return a failure, but something like using sendmail will rarely (if ever) return a failure, as the emails are just accepted regardless, and then sent later. As such, if you use sendmail (or maybe even mail) in your mail config, you'll probably need to use a different way to monitor delivery failures. –

Raza Rafaideen
  • 2,119
  • 1
  • 19
  • 30
  • 1
    If you think this is a duplicate, you probably shouldn't have answered it, but just vote to close, or link the possible duplicate in the comments. – Matteo Tassinari Dec 06 '19 at 15:45
  • 1
    @MatteoTassinari : i have provided the link and answer from the link . i told him refer the link and read the solution. but what you said is makes sense in a way .. – Raza Rafaideen Dec 07 '19 at 09:57