Support the ongoing development of Laravel.io →
posted 10 years ago
Mail
Last updated 2 years ago.
0

Hi brunodemarchi,

You could use the Observer (publisher-subscribers) to maintain notified all subscriber classes or entities that you need to know about the e-mail activity through some events.

Last updated 2 years ago.
0

The mail class has a failures method which should give you any addresses that it failed to send to. Not tested this, but this should work...

Mail::send(...)

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

   echo "There was one or more failures. They were: <br />";

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

} else {
    echo "No errors, all sent successfully!";
}
Last updated 2 years ago.
0

I believe Mail::send() returns a count of sent items, therefore if you're sending to a single recipient, your code could be as simple as your own example:

if (Mail::send(...)) {...

If you are sending to more than 1 recipient then the previous post is probably more suitable.

Last updated 2 years ago.
0

My failure doesn't return anything on failure. what should i do.?

0

Mail::failures is not working properly in laravel 4.2..

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.