Skip to content
Advertisement

Send email notification if email send failed during sending email using dynamic email credential in Laravel 5.6

Sending an email using a dynamic email credential. Now, if the credentials are wrong, then the system needs to notify the same via email using the email configuration set in the env (default).

I have tried to send the email in the exception (catch) block after resetting the email config to the default(env) but the email is not sending and showing the old error. In case of other exceptions like 1/0, the error notification email is working well in the catch block.

Could anyone can suggest to me any solution to overcome this situation?

Advertisement

Answer

Did not find any proper solution but tried something which overcomes the situation I faced. If a mail exception occurred then in the exception block I have added this in to a error log table. Set a CRON job that runs with 1hr interval and will check the log table if there any log created within the last hour.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement