protected function _smtp($id,$pw) {
		$socket=@fsockopen(
			(strtolower($this->args['scheme'])=='ssl'?
				'ssl://':'').$this->args['host'],
				$this->args['port']);
		$dialog=function($cmd=NULL) use($socket) {
			if (!is_null($cmd))
				fputs($socket,$cmd."\r\n");
			$reply='';
			while (!feof($socket) &&
				($info=stream_get_meta_data($socket)) &&
				!$info['timed_out'] && $str=fgets($socket,4096)) {
				$reply.=$str;
				if (preg_match('/(?:^|\n)\d{3} .+\r\n/s',
					$reply))
					break;
			}
			return $reply;
		};
		if ($socket) {
			stream_set_blocking($socket,TRUE);
			$dialog();
			$fw=Base::instance();
			$dialog('EHLO '.$fw->HOST);
			if (strtolower($this->args['scheme'])=='tls') {
				$dialog('STARTTLS');
				stream_socket_enable_crypto(
					$socket,TRUE,STREAM_CRYPTO_METHOD_TLS_CLIENT);
				$dialog('EHLO '.$fw->HOST);
			}
			// Authenticate
			$dialog('AUTH LOGIN');
			$dialog(base64_encode($id));
			$reply=$dialog(base64_encode($pw));
			$dialog('QUIT');
			fclose($socket);
			return (bool)preg_match('/^235 /',$reply);
		}
		user_error(self::E_SMTP,E_USER_ERROR);
	}
protected function _smtp($id,$pw) {
		$socket=@fsockopen(
			(strtolower($this->args['scheme'])=='ssl'?
				'ssl://':'').$this->args['host'],
				$this->args['port']);
		$dialog=function($cmd=NULL) use($socket) {
			if (!is_null($cmd))
				fputs($socket,$cmd."\r\n");
			$reply='';
			while (!feof($socket) &&
				($info=stream_get_meta_data($socket)) &&
				!$info['timed_out'] && $str=fgets($socket,4096)) {
				$reply.=$str;
				if (preg_match('/(?:^|\n)\d{3} .+\r\n/s',
					$reply))
					break;
			}
			return $reply;
		};
		if ($socket) {
			stream_set_blocking($socket,TRUE);
			$dialog();
			$fw=Base::instance();
			$dialog('EHLO '.$fw->HOST);
			if (strtolower($this->args['scheme'])=='tls') {
				$dialog('STARTTLS');
				stream_socket_enable_crypto(
					$socket,TRUE,STREAM_CRYPTO_METHOD_TLS_CLIENT);
				$dialog('EHLO '.$fw->HOST);
			}
			// Authenticate
			$dialog('AUTH LOGIN');
			$dialog(base64_encode($id));
			$reply=$dialog(base64_encode($pw));
			$dialog('QUIT');
			fclose($socket);
			return (bool)preg_match('/^235 /',$reply);
		}
		user_error(self::E_SMTP,E_USER_ERROR);
	}
protected function _smtp ( $ id , $ pw ) { $ socket = @ fsockopen ( ( strtolower ( $ this -> args [ 'scheme' ] ) == 'ssl' ? 'ssl://' : '' ) . $ this -> args [ 'host' ] , $ this -> args [ 'port' ] ) ; $ dialog = function ( $ cmd = NULL ) use ( $ socket ) { if ( ! is_null ( $ cmd ) ) fputs ( $ socket , $ cmd . "\r\n" ) ; $ reply = '' ; while ( ! feof ( $ socket ) && ( $ info = stream_get_meta_data ( $ socket ) ) && ! $ info [ 'timed_out' ] && $ str = fgets ( $ socket , 4096 ) ) { $ reply .= $ str ; if ( preg_match ( '/(?:^|\n)\d{3} .+\r\n/s' , $ reply ) ) break ; } return $ reply ; } ; if ( $ socket ) { stream_set_blocking ( $ socket , TRUE ) ; $ dialog ( ) ; $ fw = Base :: instance ( ) ; $ dialog ( 'EHLO ' . $ fw -> HOST ) ; if ( strtolower ( $ this -> args [ 'scheme' ] ) == 'tls' ) { $ dialog ( 'STARTTLS' ) ; stream_socket_enable_crypto ( $ socket , TRUE , STREAM_CRYPTO_METHOD_TLS_CLIENT ) ; $ dialog ( 'EHLO ' . $ fw -> HOST ) ; } // Authenticate $ dialog ( 'AUTH LOGIN' ) ; $ dialog ( base64_encode ( $ id ) ) ; $ reply = $ dialog ( base64_encode ( $ pw ) ) ; $ dialog ( 'QUIT' ) ; fclose ( $ socket ) ; return ( bool ) preg_match ( '/^235 /' , $ reply ) ; } user_error ( self :: E_SMTP , E_USER_ERROR ) ; }
SMTP storage handler
@return bool
@param $id string
@param $pw string
SMTP storage handler