fuel/fuel/packages/email/classes/email/driver/smtp.php
protected function smtp_send($data, $expecting, $return_number = false)
	{
		! is_array($expecting) and $expecting !== false and $expecting = array($expecting);

		stream_set_timeout($this->smtp_connection, $this->config['smtp']['timeout']);
		if ( ! fputs($this->smtp_connection, $data . $this->config['newline']))
		{
			if($expecting === false)
			{
				return false;
			}
			throw new \SmtpCommandFailureException('Failed executing command: '. $data);
		}

		$info = stream_get_meta_data($this->smtp_connection);
		if($info['timed_out'])
		{
			throw new \SmtpTimeoutException('SMTP connection timed out.');
		}

		// Get the reponse
		$response = $this->smtp_get_response();

		// Get the reponse number
		$number = (int) substr(trim($response), 0, 3);

		// Check against expected result
		if($expecting !== false and ! in_array($number, $expecting))
		{
			throw new \SmtpCommandFailureException('Got an unexpected response from host on command: ['.$data.'] expecting: '.join(' or ',$expecting).' received: '.$response);
		}

		if($return_number)
		{
			return $number;
		}

		return $response;
	}
protected function smtp_send($data, $expecting, $return_number = false)
	{
		! is_array($expecting) and $expecting !== false and $expecting = array($expecting);

		stream_set_timeout($this->smtp_connection, $this->config['smtp']['timeout']);
		if ( ! fputs($this->smtp_connection, $data . $this->config['newline']))
		{
			if($expecting === false)
			{
				return false;
			}
			throw new \SmtpCommandFailureException('Failed executing command: '. $data);
		}

		$info = stream_get_meta_data($this->smtp_connection);
		if($info['timed_out'])
		{
			throw new \SmtpTimeoutException('SMTP connection timed out.');
		}

		// Get the reponse
		$response = $this->smtp_get_response();

		// Get the reponse number
		$number = (int) substr(trim($response), 0, 3);

		// Check against expected result
		if($expecting !== false and ! in_array($number, $expecting))
		{
			throw new \SmtpCommandFailureException('Got an unexpected response from host on command: ['.$data.'] expecting: '.join(' or ',$expecting).' received: '.$response);
		}

		if($return_number)
		{
			return $number;
		}

		return $response;
	}
protected function smtp_send ( $ data , $ expecting , $ return_number = false ) { ! is_array ( $ expecting ) and $ expecting !== false and $ expecting = array ( $ expecting ) ; stream_set_timeout ( $ this -> smtp_connection , $ this -> config [ 'smtp' ] [ 'timeout' ] ) ; if ( ! fputs ( $ this -> smtp_connection , $ data . $ this -> config [ 'newline' ] ) ) { if ( $ expecting === false ) { return false ; } throw new \ SmtpCommandFailureException ( 'Failed executing command: ' . $ data ) ; } $ info = stream_get_meta_data ( $ this -> smtp_connection ) ; if ( $ info [ 'timed_out' ] ) { throw new \ SmtpTimeoutException ( 'SMTP connection timed out.' ) ; } // Get the reponse $ response = $ this -> smtp_get_response ( ) ; // Get the reponse number $ number = ( int ) substr ( trim ( $ response ) , 0 , 3 ) ; // Check against expected result if ( $ expecting !== false and ! in_array ( $ number , $ expecting ) ) { throw new \ SmtpCommandFailureException ( 'Got an unexpected response from host on command: [' . $ data . '] expecting: ' . join ( ' or ' , $ expecting ) . ' received: ' . $ response ) ; } if ( $ return_number ) { return $ number ; } return $ response ; }
Sends data to the SMTP host

@param   string              $data           The SMTP command
@param   string|bool|string  $expecting      The expected response
@param   bool                $return_number  Set to true to return the status number

@throws \SmtpCommandFailureException When the command failed an expecting is not set to false.
@throws \SmtpTimeoutException        SMTP connection timed out

@return   mixed                         Result or result number, false when expecting is false
Sends data to the SMTP host