Laravel 5 - check if mail is send

2019-05-21 14:28发布

问题:

Is there a way to be a 100% sure that the email you want to send is actually delivered (I'm not talking about an email address that doesn't exist)?

Can you do an extra check? I'm working in Larevel 5.0.

回答1:

Mail::send(...)

And Error Reporting is

if( count(Mail::failures()) > 0 ) {

   foreach(Mail::failures as $email_address) {
       echo "$email_address <br />";
    }

} else {
    echo "Mail sent successfully!";
}


回答2:

Are you checking Mail::failures() ?



回答3:

If you want 100% certainty, you should use a third party API such as mailgun. Laravel supports them out of the box, and they offer in-depth tracking.