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); } }