WordPress.org

Ready to get started?Download WordPress

Forums

wpMandrill
Using Mandrill in other Plugins (6 posts)

  1. respectyoda
    Member
    Posted 6 months ago #

    I am trying to use the "wpMandrill::mail" function call in another plugin. Is there anything I need to declare somewhere in order for this function call to work in another plugin?

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

  2. MC_Will
    Member
    Plugin Author

    Posted 6 months ago #

    No, you just need to have wpMandrill activated.

    Where and when are you calling it?

    There are some scenarios where the plugin might not be loaded. Be sure it is.

  3. respectyoda
    Member
    Posted 6 months ago #

    I see. I already have it activated and I know it definitely works as a test email always is sent out properly.

    I was testing the function call with a plugin called 'Product Enquiry for Woocommerce' which is available for download on this site (link here: Product Enquiry).

    I replaced line 212 which says:

    @mail($to, $subject, $body, $headers) or
    		die("Unfortunately, a server issue prevented delivery of your message.");

    ...with this....

    wpMandrill::mail($to, $subject, $body, $headers) or
    		die("Unfortunately, a server issue prevented delivery of your message.");
  4. MC_Will
    Member
    Plugin Author

    Posted 6 months ago #

    PHP mail() function returns false on error. wpMandrill::mail() returns WP_Error on error. You can't just swap the functions.

  5. respectyoda
    Member
    Posted 6 months ago #

    I see. OK. What is your suggestion then?

  6. jcow
    Member
    Posted 3 months ago #

    You shouldn't use php mail() in a WordPress plugin. You don't need to hard code mandrill into a plugin either. Well... not ideally. There are potential situations maybe...

    But you can just use wp_mail(). Which is the desired way to send emails in WordPress 99% of the time. Mandrill replaces that to send through their smtp.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.