Solving Mail Poet & Mandrill Problem
We have a client that has a WordPress website and who had installed a great little plugin for sending newsletters called “MailPoet.” MailPoet is pretty nifty as it’s pretty simple to create email newsletters that are HTML based and look very professional that website owners can send out to subscribers. In addition to sending out newsletter type of emails to lists, it can also act as an auto-responder, with automatic emails sent out at predetermined times after a new subscriber has subscribed to your list.
The client also had an account with Mandrill, a service that is similar to Aweber but that has much less expensive fees. In fact, the first 12,000 emails in a month are free. It’s got some nice features and you can use the service from a remote server using an API key. MailPoet has a setting that should allow users to connect to the Mandrill server to send email, but it was not working. It’s possible his hosting provider has some configurations which are causing the problem, but we were able to find a work around for him.
WordPress has it’s own email abilities built in however, MailPoet does not provide an option for using WP Mail to deliver emails, only PHP and Sendmail, or using a third party (which didn’t work in this particular instance).
So, we were able to come up with a solution that even is bullet proof against upgrades (although if you change WordPress themes, you will need to remember this modification for it to continue working).
First, we needed to install another plugin called “wpMandrill.” Once this is configured correctly, using the settings provide by Mandrill, all email from the WordPress site will be sent via the Mandrill’s email servers. However, to make this work with MailPoet, we needed to make the MailPoet plugin have the ability to use WP Mail.
This was done by adding a small snippet of code to the ‘functions.php’ file within the theme directory:
function mailpoet_enable_wpmail(){
if(class_exists(‘WYSIJA’)){
$model_config = WYSIJA::get(‘config’,’model’);
$model_config->save(array(‘allow_wpmail’ => true));
}
}
add_action(‘init’, ‘mailpoet_enable_wpmail’);
One this was added, a radio button option for WP Mail showed up in the MailPoet settings area, which was then selected and saved.
Email now can be sent using MailPoet and the wpMandrill plugin acting as a “bridge” to use the services of Mandrill.