fuel/fuel/packages/email/classes/email/driver/smtp.php
protected function _send()
	{
		$message = $this->build_message(true);

		if(empty($this->config['smtp']['host']) or empty($this->config['smtp']['port']))
		{
			throw new \FuelException('Must supply a SMTP host and port, none given.');
		}

		// Use authentication?
		$authenticate = (empty($this->smtp_connection) and ! empty($this->config['smtp']['username']) and ! empty($this->config['smtp']['password']));

		// Connect
		$this->smtp_connect();

		// Authenticate when needed
		$authenticate and $this->smtp_authenticate();

		// Set from
		$this->smtp_send('MAIL FROM:<'.$this->config['from']['email'].'>', 250);

		foreach(array('to', 'cc', 'bcc') as $list)
		{
			foreach($this->{$list} as $recipient)
			{
				$this->smtp_send('RCPT TO:<'.$recipient['email'].'>', array(250, 251));
			}
		}

		// Prepare for data sending
		$this->smtp_send('DATA', 354);

		$lines = explode($this->config['newline'], $message['header'].preg_replace('/^\./m', '..$1', $message['body']));

		foreach($lines as $line)
		{
			if(substr($line, 0, 1) === '.')
			{
				$line = '.'.$line;
			}

			fputs($this->smtp_connection, $line.$this->config['newline']);
		}

		// Finish the message
		$this->smtp_send('.', 250);

		// Close the connection if we're not using pipelining
		$this->pipelining or $this->smtp_disconnect();

		return true;
	}
protected function _send()
	{
		$message = $this->build_message(true);

		if(empty($this->config['smtp']['host']) or empty($this->config['smtp']['port']))
		{
			throw new \FuelException('Must supply a SMTP host and port, none given.');
		}

		// Use authentication?
		$authenticate = (empty($this->smtp_connection) and ! empty($this->config['smtp']['username']) and ! empty($this->config['smtp']['password']));

		// Connect
		$this->smtp_connect();

		// Authenticate when needed
		$authenticate and $this->smtp_authenticate();

		// Set from
		$this->smtp_send('MAIL FROM:<'.$this->config['from']['email'].'>', 250);

		foreach(array('to', 'cc', 'bcc') as $list)
		{
			foreach($this->{$list} as $recipient)
			{
				$this->smtp_send('RCPT TO:<'.$recipient['email'].'>', array(250, 251));
			}
		}

		// Prepare for data sending
		$this->smtp_send('DATA', 354);

		$lines = explode($this->config['newline'], $message['header'].preg_replace('/^\./m', '..$1', $message['body']));

		foreach($lines as $line)
		{
			if(substr($line, 0, 1) === '.')
			{
				$line = '.'.$line;
			}

			fputs($this->smtp_connection, $line.$this->config['newline']);
		}

		// Finish the message
		$this->smtp_send('.', 250);

		// Close the connection if we're not using pipelining
		$this->pipelining or $this->smtp_disconnect();

		return true;
	}
protected function _send ( ) { $ message = $ this -> build_message ( true ) ; if ( empty ( $ this -> config [ 'smtp' ] [ 'host' ] ) or empty ( $ this -> config [ 'smtp' ] [ 'port' ] ) ) { throw new \ FuelException ( 'Must supply a SMTP host and port, none given.' ) ; } // Use authentication? $ authenticate = ( empty ( $ this -> smtp_connection ) and ! empty ( $ this -> config [ 'smtp' ] [ 'username' ] ) and ! empty ( $ this -> config [ 'smtp' ] [ 'password' ] ) ) ; // Connect $ this -> smtp_connect ( ) ; // Authenticate when needed $ authenticate and $ this -> smtp_authenticate ( ) ; // Set from $ this -> smtp_send ( 'MAIL FROM:<' . $ this -> config [ 'from' ] [ 'email' ] . '>' , 250 ) ; foreach ( array ( 'to' , 'cc' , 'bcc' ) as $ list ) { foreach ( $ this -> { $ list } as $ recipient ) { $ this -> smtp_send ( 'RCPT TO:<' . $ recipient [ 'email' ] . '>' , array ( 250 , 251 ) ) ; } } // Prepare for data sending $ this -> smtp_send ( 'DATA' , 354 ) ; $ lines = explode ( $ this -> config [ 'newline' ] , $ message [ 'header' ] . preg_replace ( '/^\./m' , '..$1' , $ message [ 'body' ] ) ) ; foreach ( $ lines as $ line ) { if ( substr ( $ line , 0 , 1 ) === '.' ) { $ line = '.' . $ line ; } fputs ( $ this -> smtp_connection , $ line . $ this -> config [ 'newline' ] ) ; } // Finish the message $ this -> smtp_send ( '.' , 250 ) ; // Close the connection if we're not using pipelining $ this -> pipelining or $ this -> smtp_disconnect ( ) ; return true ; }
Initalted all needed for SMTP mailing.

@throws \FuelException   Must supply a SMTP host and port, none given

@return  bool    Success boolean
Initalted all needed for SMTP mailing .