Currently, there are 0 users and 1 guest visiting this topic.
  • This topic has Feature prefix assigned
Author
Topic
#65480

¿It would be posible to automatically send failed emails to queue?
¿By cron job or any other way?

Topic Information
General Question
7.2
5.4.4
3.8
Viewing 10 replies - 1 through 10 (of 10 total)
Author
Replies
  • #65481

    Hi,

    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.

  • #65482

    I 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.

  • #65483

    If 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.

  • #65484

    But I want/need this automatically, because of many shorts smtp downtimes.

  • #65485

    I don’t care of failed emails by unreached destination, because smtp server don’t return me error in that case.

  • #65486

    Sorry, there is no option to do that now.

    Dev4Press - Premium plugins for WordPress.

  • #65487

    Ok, thank you.

  • #65493

    It’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);
  • #65494

    Yeah, this looks OK. But, it will add new email into the queue, instead of changing the existing one to be retried. I will investigate this for the next update. I will mark this as a feature suggestion.

    Dev4Press - Premium plugins for WordPress.

    1 user thanked author for this post.
  • #65495

    I know what you mean, but that’s require to modify your code and I extends only for future updates.
    Thank you.

Viewing 10 replies - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.
Register

If you don't have an account on this website, you can register for a free account here:

Register