-
Milan Petrovic
KeymasterMarch 4, 2021 at 9:37 am #65481Hi,
There is no way to capture email after the sending has failed. The only way to hook into WordPress wp_mail function is to do it before it does anything related to sending. After the sending fails, there is nothing it can be done. But, the wp_mail function can be replaced (WordPress allows that), and changed to do something like this. This is in theory only, I have not tried anything like that. My plugin is the only mail handling plugin for WordPress that doesn’t replace wp_mail, and I have no plans to implement such replacements, it can ultimately lead to issues across different WordPress versions.
Milan
Dev4Press - Premium plugins for WordPress.
-
avelap
ParticipantMarch 4, 2021 at 9:40 am #65482I mean resend and email that it was on queue but failed by smtp connect by example.
A custom code on ‘qdmaq_queue_phpmailer_email_send’ that send again to queue the email. -
Milan Petrovic
KeymasterMarch 4, 2021 at 9:48 am #65483If the email was already in queue and sending failed, right now, you have the Retry button in the Log for each failed item, and it also has bulk retry for the log. You do need to run it that way because an automatic queue of failed emails can be a huge issue if the same email fails over and over. If you don’t see this Retry action in the log, you need to enable it through plugin Settings -> Log -> Additional Log Actions.
Milan
Dev4Press - Premium plugins for WordPress.
-
avelap
ParticipantMarch 4, 2021 at 9:51 am #65484But I want/need this automatically, because of many shorts smtp downtimes.
-
avelap
ParticipantMarch 4, 2021 at 9:56 am #65485I don’t care of failed emails by unreached destination, because smtp server don’t return me error in that case.
-
Milan Petrovic
Keymaster -
avelap
ParticipantMarch 4, 2021 at 10:18 am #65487Ok, thank you.
-
avelap
ParticipantMarch 4, 2021 at 12:00 pm #65493It’s not the best code, but it could do the work.
What do you think?gd-mail-queue-tweaks.php
<?php function send_failed_email($status, $email, $phpmailer){ if (!$status['result']) { $email_new = new gdmaq_core_email('mirror', $email); $email_new->add_to_queue(); } } add_action('qdmaq_queue_phpmailer_email_send', 'send_failed_email', 20, 3); -
Milan Petrovic
KeymasterMarch 4, 2021 at 2:24 pm #65494 -
avelap
ParticipantMarch 4, 2021 at 2:27 pm #65495I know what you mean, but that’s require to modify your code and I extends only for future updates.
Thank you.
- The topic ‘Retry automatically failed emails’ is closed to new replies.