Currently, there are 0 users and 1 guest visiting this topic.
Author
Topic
#61397

This plugin is working as expected. In my case, following a new topic or new WP post, email notifications are sent out over a couple of hours. If several posts happen in the same time frame, emails could take many hours to be sent. That is how it should be.

However, there are certain emails for which this delay is problematic. For example, sending a password reset link. The user will give up waiting long before the email with the link arrives and will make another reset request, which will invalidate the link in the email yet to arrive.

So certain emails need to be sent immediately and not through the queue. I can think of:

  • Password resets
  • Email address verification emails
  • Notifications to admin, such as incidents of user lock-out, new user registrations etc.

I doubt that there is any easy way of identifying these? Maybe it would be best to be able to register a number of text patterns and if the outgoing email matches any of these patterns, it is sent immediately rather than being placed in the queue?

What do you think?

Topic Information
Viewing 5 replies - 1 through 5 (of 5 total)
Author
Replies
  • #61398

    Hi,

    The plugin does have a way to detect where the email is coming from, and it detects all WP, bbPress, GD bbPress Toolbox Pro and BuddyPress emails right now. What it lacks right now is the way to decide on a queue based on that. But, I am preparing a new version (2.2) for tomorrow that will have a filter run before the email is added to the queue, and that can be used to decide on the queue based on the email type. The detection is not 100% perfect, because it depends on the existing actions and filters run before wp_mail in various areas, but, as long as other plugins don’t mess too much with the default mail sending functions, it will work fine.

    And, version 2.2 will bring full email log system.

    Regards,
    Milan

    Dev4Press - Premium plugins for WordPress.

  • #61440

    I think your new version gives me what I need. But I have looked at the filter documentation and FAQ and cannot see how to proceed. I have found the list of email types.

    What would be really helpful is sample filter code to skip the queue and send emails directly for, say,

    1. Admin notification when new user created
    2. Password reset link sent to user
    3. Email containing the text ‘trigger’

    Thanks

  • #61443

    Hi,

    I have added an example for the use of the filter: https://support.dev4press.com/kb/reference/gdmaq_mailer_add_to_queue/. As for the trigger in the email text, that same example can be used, but you need to check value for ‘$email->alt_body’ where the plain text of email is stored.

    Regards,
    Milan

    Dev4Press - Premium plugins for WordPress.

  • #61444

    Brilliant!

    Actually, catching all the various emails to be sent directly is rather complicated, so I have reversed the logic and just queue the ones that go out in large numbers.

    The new logging facility is great and helped me workout what was being sent from where. However, the New WP Post from the Subscribe2 plugin and WP Comment notifications from STCR were more problematic and I have had to catch these by their ad hoc headers. Not ideal and I have no way of catching the “All users” email from Subscribe2 but I can catch those sent through BuddyPress.

    And the stop emails and queue filters let me silence the emails on my test site by enabling a plugin only on that site.

    Thanks for great work.

    Here is what my filter looks like at the moment:

    // Exit if accessed directly
    defined( 'ABSPATH' ) || exit;
    
    add_filter('gdmaq_mailer_add_to_queue', 'custom__gdmaq_mailer_add_to_queue', 10, 3);
    function custom__gdmaq_mailer_add_to_queue($add, $email, $type) {
      $to_queue_types = array('bbpress_new_topic_in_forum', 'bbpress_new_reply_in_topic', 'bbpress_topic_edit', 'bbpress_reply_edit', 'buddypress_messages-unread');
      if ((in_array($type, $to_queue_types)) ||
      		(strncmp($email->subject, '[Ovni Owners] new post notification', 35) == 0) ||
      		(strncmp($email->subject, '[Ovni Owners] There is a new comment to', 35) == 0)){
        $add = true;
      }
      else {
      	$add = false;
      	}
      return $add;
    }
  • #61448

    Yeah, for some cases, it might require some extra checking to determine what the email is, but all information is provided by the plugin and it can be easily parsed or compared.

    Milan

    Dev4Press - Premium plugins for WordPress.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Enhancement request: non-queued emails’ is closed to new replies.