public function mandrill_send_email( $to, $subject, $message, $headers = '', $attachments = array(),
							$tags = array(), 
	                        $from_name = '', 
	                        $from_email = '', 
	                        $template_name = '', 
	                        $track_opens = null, 
	                        $track_clicks = null,
	                        $url_strip_qs = false,
	                        $merge = true,
	                        $global_merge_vars = array(),
	                        $merge_vars = array(),
	                        $google_analytics_domains = array(),
	                        $google_analytics_campaign = array(),
	                        $meta_data = array(),
	                        $important = false,
	                        $inline_css = null,
	                        $preserve_recipients=null,
	                        $view_content_link=null,
	                        $tracking_domain=null,
	                        $signing_domain=null,
	                        $return_path_domain=null,
	                        $subaccount=null,
	                        $recipient_metadata=null,
	                        $ip_pool=null,
	                        $send_at=null,
	                        $async=null 
						) {
		global $wp_et_mandrill_provider_configuration;
		
		$to = str_replace( '<', '', $to );
		$to = str_replace( '>', '', $to );
		$bcc_list = array();
		$cc_list = array();
		
		try {
			require_once WP_EMAIL_TEMPLATE_DIR. '/includes/mandrill/Mandrill.php';
			$mandrill = new Mandrill( $wp_et_mandrill_provider_configuration['api_key'] );
						
			extract( apply_filters( 'wp_mail', compact( 'to', 'subject', 'message', 'headers', 'attachments' ) ) );
			$html = $message;
			$mandrill_message = compact('html', 'subject', 'from_name', 'from_email', 'to', 'headers', 'attachments', 
                                    'url_strip_qs', 
                                    'merge', 
                                    'global_merge_vars', 
                                    'merge_vars',
                                    'google_analytics_domains',
                                    'google_analytics_campaign',
                                    'meta_data',
            						'important',
        							'inline_css',
        							'preserve_recipients',
        							'view_content_link',
        							'tracking_domain',
        							'signing_domain',
        							'return_path_domain',
        							'subaccount',
        							'recipient_metadata',
        							'ip_pool',
        							'send_at',
        							'async'        	
                                    );
			
			if ( empty( $mandrill_message['headers'] ) ) {
				$mandrill_message['headers'] = array();
			} else {
				if ( !is_array( $mandrill_message['headers'] ) ) {
					$tempheaders = explode( "\n", str_replace( "\r\n", "\n", $mandrill_message['headers'] ) );
				} else {
					$tempheaders = $mandrill_message['headers'];
				}
				$mandrill_message['headers'] = array();

				// If it's actually got contents
				if ( !empty( $tempheaders ) ) {
					// Iterate through the raw headers
					foreach ( (array) $tempheaders as $header ) {
						if ( strpos($header, ':') === false ) continue;

						// Explode them out
						list( $name, $content ) = explode( ':', trim( $header ), 2 );

						// Cleanup crew
						$name    = trim( $name    );
						$content = trim( $content );

						switch ( strtolower( $name ) ) {
							case 'from':
								if ( strpos($content, '<' ) !== false ) {
									// So... making my life hard again?
									$from_name = substr( $content, 0, strpos( $content, '<' ) - 1 );
									$from_name = str_replace( '"', '', $from_name );
									$from_name = trim( $from_name );

									$from_email = substr( $content, strpos( $content, '<' ) + 1 );
									$from_email = str_replace( '>', '', $from_email );
									$from_email = trim( $from_email );
								} else {
									$from_name  = '';
									$from_email = trim( $content );
								}
								$mandrill_message['from_email']  = $from_email;
								$mandrill_message['from_name']   = $from_name;						            
								break;
						            
							case 'bcc':
								// TODO: Mandrill's API only accept one BCC address. Other addresses will be silently discarded
								$bcc = array_merge( (array) $bcc, explode( ',', $content ) );
					            
								$bcc_list = $bcc;    
								break;
							
							case 'cc':
								$cc = array_merge( (array) $cc, explode( ',', $content ) );
					            
								$cc_list = $cc;    
								break;
						            
							case 'reply-to':
						            $mandrill_message['headers'][trim( $name )] = trim( $content );
								break;
							case 'importance':
							case 'x-priority':
							case 'x-msmail-priority':
								if ( !$mandrill_message['important'] ) $mandrill_message['important'] = ( strpos(strtolower($content),'high') !== false ) ? true : false;
								break;
							default:
								if ( substr($name,0,2) == 'x-' ) {
    						            $mandrill_message['headers'][trim( $name )] = trim( $content );
								}
								break;
						}
					}
				}
			}
			
			 // Adding a Reply-To header
			if ( !in_array( 'reply-to', array_map( 'strtolower', array_keys($mandrill_message['headers']) ) ) ) {
				$mandrill_message['headers']['Reply-To'] = get_option('admin_email');
			}

	        // Checking To: field
			if( !is_array($mandrill_message['to']) ) $mandrill_message['to'] = explode(',', $mandrill_message['to']);
                
			$processed_to = array();
			foreach ( $mandrill_message['to'] as $email ) {
				if ( is_array($email) ) {
                	$processed_to[] = $email;
				} else { 
                	$processed_to[] = array( 'email' => $email );
				}
			}
			
			if ( is_array( $bcc_list ) && count( $bcc_list ) > 0 ) {
				foreach ( $bcc_list as $bcc_email ) {
					$bcc_email = str_replace( '<', '', $bcc_email );
					$bcc_email = str_replace( '>', '', $bcc_email );
					$processed_to[] = array( 'email' => $bcc_email, 'type' => 'bcc' );
				}
			}
			
			if ( is_array( $cc_list ) && count( $cc_list ) > 0 ) {
				foreach ( $cc_list as $cc_email ) {
					$cc_email = str_replace( '<', '', $cc_email );
					$cc_email = str_replace( '>', '', $cc_email );
					$processed_to[] = array( 'email' => $cc_email, 'type' => 'cc' );
				}
			}
			
			$mandrill_message['to'] = $processed_to;
	        
	        // Checking From: field
			if ( empty($mandrill_message['from_email']) ) $mandrill_message['from_email'] = get_option('admin_email');
			if ( empty($mandrill_message['from_name'] ) ) $mandrill_message['from_name']  = get_option('blogname');
            
            // Checking tags.
			$mandrill_message['tags']        = $mandrill->findTags($tags);
		    
		    // Checking attachments
			if ( !empty($mandrill_message['attachments']) ) {
				$mandrill_message['attachments'] = $mandrill->processAttachments($mandrill_message['attachments']);
				if ( is_wp_error($mandrill_message['attachments']) ) {
					$this->set_mandrill_send_email_error( 'Invalid attachment.' );
				} elseif ( !is_array($mandrill_message['attachments']) ) {	// some plugins return this value malformed.
					unset($mandrill_message['attachments']);
				}
			}
		    // Default values for other parameters
			$mandrill_message['auto_text']   = true;
			$mandrill_message['track_opens'] = $wp_et_mandrill_provider_configuration['enable_track_opens'];
			$mandrill_message['track_clicks']= $wp_et_mandrill_provider_configuration['enable_track_clicks'];
                
            // Letting user to filter/change the mandrill_message payload
			$mandrill_message['from_email']  = apply_filters('wp_mail_from', $mandrill_message['from_email']);
			$mandrill_message['from_name']	= apply_filters('wp_mail_from_name', $mandrill_message['from_name']);
                
			// if user doesn't want to process this email by wp_mandrill, so be it.
			if ( isset($mandrill_message['force_native']) && $mandrill_message['force_native'] ) $this->set_mandrill_send_email_error( 'Manually falling back to native wp_mail()' );
                
            // Setting the tags property correctly to be received by the Mandrill's API
			if ( !is_array($mandrill_message['tags']['user']) )      $mandrill_message['tags']['user']        = array();
			if ( !is_array($mandrill_message['tags']['general']) )   $mandrill_message['tags']['general']     = array();
			if ( !is_array($mandrill_message['tags']['automatic']) ) $mandrill_message['tags']['automatic']   = array();
                
			$mandrill_message['tags'] = array_merge( $mandrill_message['tags']['general'], $mandrill_message['tags']['automatic'], $mandrill_message['tags']['user'] );
			
			$result = $mandrill->messages->send( $mandrill_message );
			
			if ( is_array( $result ) && $result[0]['status'] == 'sent' )
				return true;		
			else
				return false;
		} catch ( Exception $e ) {
			$this->set_mandrill_send_email_error( $e->getMessage() );
			return false;
		}
	}