• Hello,

    Loving the design of this plugin so far, it isn’t however doing what I need it to. I have another plugin that sends emails using the wp_mail function, but it’s just going ahead and sending the email and not sending it to the queue.

    I have it enabled to catch all emails in the settings.

    Any ideas?

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Eddie

    (@eddietate)

    For anyone else facing this issue or similar, I’ve put together a temporary piece of code for myself, the following piece of code assumes the email is formatted in HTML and not just plain text, but should work both ways.

    Additionally, there is probably a better way to do this, like a function, but here goes:

    global $wpdb;
    $queue_table_name = $wpdb->prefix . 'gdmaq_queue';
    
    $wpdb->insert( 
    	$queue_table_name, 
    	array( 
    		'blog_id' => '1', 
    		'status' => 'queue', // this adds the email to the queue list
    		'queued' => $date, // current date formatted like: $date = date("Y-m-d H:i:s");
    		'sent' => '0000-00-00 00:00:0', // blank date that will be changed once the queued email has been send
    		'type' => 'mail',
    		'to_email' => $receivingemail, // variable for your too address
    		'subject' => $subject,	// variable for your subject
    		'plain' => '',
    		'html' => $body, // the email content
    		'headers' => '[]',
    		'attachments' => '[]',
    		'extras' => '{"CharSet":"UTF-8","ContentType":"text\/html","Encoding":"8bit","From":"[email protected]","FromName":"FromName"}', // Header information, this changes the from email address and from name.
    		'message' => '',
    	) 
    );

    I’ve put this in-place of the wp_mail(); function. This adds all the info to the queue database and it will be sent on the next queue run.

    This is currently working for me in a custom built plugin.

    As stated, there’s probably a better method like a function but I’ve yet to find it.

    • This reply was modified 5 years, 5 months ago by Eddie.
    Plugin Author Milan Petrovic

    (@gdragon)

    Can you tell me what emails plugin doesn’t catch? Do you have some other plugin that is manipulating wp_mail, or maybe replacing it (that is usually the problem, replacement function is missing the filter and actions my plugin uses)?

    Plugin has a function for adding email directly into the queue: https://support.dev4press.com/kb/reference/gdmaq_mail_to_queue/

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Plugin isn’t catching all wp_mail initiations.’ is closed to new replies.