WordPress.org

Ready to get started?Download WordPress

Forums

wpMandrill
[resolved] wp_mail has been declared by another process or plugin (9 posts)

  1. treybo
    Member
    Posted 11 months ago #

    I have narrowed the conflict down to Mandrill and NextGEN Gallery by Photocrati. A quick search shows me that this sort of conflict has also arisen with other plugins and wp_mail. The error persists in 3.6 and 3.5.2

    Any advice on how to fix this?

    Mandrill: wp_mail has been declared by another process or plugin, so you won't be able to use Mandrill until the problem is solved.

    http://wordpress.org/plugins/wpmandrill/

  2. latinosamorir
    Member
    Posted 10 months ago #

    I have the same issue --- any updates would be appreciated.

  3. hombresensato
    Member
    Posted 10 months ago #

    Any response on this problem?
    I'm getting the same message when using NextGEN Gallery by Photocrati.

    my wordpress is V3.6

  4. MC_Will
    Member
    Plugin Author

    Posted 10 months ago #

    Hello,

    Problem is that NextGEN is loading the following file in its constructor:
    include_once(path_join(ABSPATH, 'wp-includes/pluggable.php'));

    That files loads the whole library of WordPress pluggable functions which have not been loaded by the time it is included. Unfortunately wp_mail is one of those functions that gets loaded.

    So plugins fail (wpMandrill or NextGEN or whatever) when they try to override any pluggable function after NextGEN has been declared/loaded. wpMandrill, at least, fails gratefully! ;)

    They should try to makes NextGEN load after all other plugins have been loaded, or implement a lazy/delayed loading in their plugin.

  5. latinosamorir
    Member
    Posted 10 months ago #

    Is there anything else that can be done in the meantime?

    I love both plugins and would hate to have to deactivate one (unfortunately in this case it would have to be Mandrill since my website is image heavy).

    Thank you!

  6. MC_Will
    Member
    Plugin Author

    Posted 10 months ago #

    Well, you can do the required modifications in NextGEN to make it work as it should but you'll probably lose those changes if they don't address this issue in their next release.

    Another option could be to use the WP Mail STMP plugin and send your emails through Mandrill via SMTP:
    http://help.mandrill.com/entries/21738447-Can-I-use-Mandrill-to-send-email-through-my-content-management-system-CMS-

    Good luck!

  7. ianarmstrong
    Member
    Posted 5 months ago #

    I have a custom plugin, which I wrote from scratch (other than Redux), that doesn't call anything remotely close to mail, which triggers this error. I'm completely at a loss to explain it. Will do more reading.

  8. MC_Will
    Member
    Plugin Author

    Posted 5 months ago #

    Hm. Interesting.

    That error is only triggered when another process declares wp_mail before wpMandrill tries to do that.

    Assuming you are completely sure it is in fact your plugin the one that is triggering the error, and given that your plugin doesn't do that directly, I'd say it does it indirectly. I mean, are you including another library or plugin that might be declaring wp_mail?

    What I'd do is to break my custom plugin into tiny pieces and give them a try from its most simple form to its full version... and see what part of the code is the culprit.

    Keep me posted!

  9. Steve Truman
    Member
    Posted 5 months ago #

    Hello MC_Will

    Just posting this feedback as I hope it might help you a little bit. Our Plugin WP Email Template was conflicting with wpMandrill in a similar way as this thread - see this wpMandrill support thread

    WP Email incompatibility

    As developers of that plugin we have found and resolved that issue today so you can mark that thread as resolved.

    The WP Email Template has a preview Template feature on the admin panel that runs a URL where the user can preview the template in their browser. We run this php file to create a security parameter on the preview url

    require_once( ABSPATH . 'wp-includes/pluggable.php' );

    That file defines wp_mail() function which generates this wpMandrill Error Message

    Mandrill: wp_mail has been declared by another process or plugin, so you won't be able to use Mandrill until the problem is solved.

    As it secures the URL we did not want to just remove it so we have written a conditional statement that allows us to still secure the URL but not define wp_mail and so have solved the conflict. Here is the code we have used to update our plugin.

    if ( is_admin() && in_array (basename($_SERVER['PHP_SELF']), array('options-general.php') ) && isset( $_GET['page'] ) && $_GET['page'] == 'email_template' ) {
       require_once( ABSPATH . 'wp-includes/pluggable.php' );
      }

    We run internal preview links in 2 other plugins and have also updated them to new versions. WooCommerce Dynamic gallery and WP e-Commerce Dynamic Gallery.

    I hope that helps you a bit - Steve

Reply

You must log in to post.

About this Plugin

About this Topic