• On a copy of WordPress 4.1, the wpMandrill plugin appears to be not loading in time or otherwise making its wp_mail() replacement for any emails that are generated by front-end functions. Emails sent through the WP dashboard (including Gravity Forms resends and test emails in the plugin) do work just fine, but anything – password resets, Gravity Forms confirmations, etc. – sent through something elsewhere go native.

    The wp_mail() replacement is never getting hit at all. This is occurring whether or not a user is logged in. There are no other email-related plugins installed. This appears to have only started cropping up in the last couple days, and nothing related to Mandrill has changed.

    It does appear that the wpMandrill class is being made available, because dropping the replacement wp_mail():

    function wp_mail( $to, $subject, $message, $headers = '', $attachments = array() ) {
    		try {
    			$sent = wpMandrill::mail( $to, $subject, $message, $headers, $attachments );
    			if (    is_wp_error($sent)
    				|| !isset($sent[0]['status'])
    				|| ($sent[0]['status'] != 'sent' && $sent[0]['status'] != 'queued') ) {
    					return wpMandrill::wp_mail_native( $to, $subject, $message, $headers, $attachments );
    			}
    			return true;
    		} catch ( Exception $e ) {
    			return wpMandrill::wp_mail_native( $to, $subject, $message, $headers, $attachments );
    		}
    	}

    …in another plugin, with a name that starts with ‘a’, makes everything work again. Yet, if that’s wrapped in if(class_exists("wpMandrill")) { }… nothing, again.

    Any idea why this is happening?

    https://www.ads-software.com/plugins/wpmandrill/

  • The topic ‘Plugin not loading/redefining wp_mail in WP frontend’ is closed to new replies.