1+ <pre><?php 
2+ 3+ /** 
4+  * This is an example of how to connect to your local email server. 
5+  * The variables set in the class should be adjusted to your own environment 
6+  * 
7+  *  
8+  */ 
9+ 10+  define ('PRINCE_SOCKET ' , 'active ' ); 
11+  include ("PrinceSocket.Class.php " );
12+ 13+ /* 
14+ function reqHandler($request, $id) 
15+ { 
16+  if (1 === preg_match('/quit|exit/i', $request)) { 
17+  return null; 
18+  } 
19+ 
20+  if (1 === preg_match('/stop|halt/i', $request)) { 
21+  return false; 
22+  } 
23+ 
24+  echo sprintf('*** Got "%s" from %d', $request, $id) . PHP_EOL; 
25+  return $request . PHP_EOL; 
26+ } 
27+ 
28+ 
29+ $socket = PrinceSocket::Singleton(); 
30+ if( $socket ) 
31+ { 
32+ 	$socket->_Connect( $host, $port ) 
33+ 	$cmd = isset( $_REQUEST['cmd'] ) && !empty ( $_REQUEST['cmd']) ) ? trim($_REQUEST['cmd']) : ''; 
34+ 
35+ 	if( $cmd != '' ) 
36+ 	{ 
37+ 		$socket::PrinceCMD( $cmd ); 
38+ 
39+ 		$result = $socket::getResponse();			 
40+ 		echo $result; 
41+ 	} 
42+ } 
43+ 
44+ */ 
45+ 46+ $ socketSingleton ();
47+ 48+ //if( $socket::_Connect('176.31.127.164', '9400') ) 
49+ if ( $ socket_Connect ('176.31.127.164 ' , '25 ' ) )
50+ {
51+ 	//echo "connected"; 
52+ 	echo  $ socketgetResponse (); 
53+ 54+ 	$ socketPrinceCMD ("helo hostname " ); 
55+ 	echo  $ socketgetResponse (); 
56+ 57+ 	$ socketPrinceCMD ("AUTH LOGIN " ); 
58+ 	echo  $ socketgetResponse (); // #: Login to your email; 
59+ 60+ 	//prepare your user and pass encoded in base64. 
61+ 62+ 	$ userbase64_encode  ("user@domain.com " );
63+ 	$ passbase64_encode  ("YourPass " );
64+ 65+ 	$ socketPrinceCMD ( $ user
66+ 	echo  $ socketgetResponse (); // #: +OK Password required. 
67+ 68+ 	$ socketPrinceCMD ( $ pass
69+ 	echo  $ socketgetResponse (); // #: +OK logged in. 
70+ 71+ 	$ socketPrinceCMD ("MAIL FROM:<user@domain.com> " );
72+ 	echo  $ socketgetResponse ();
73+ 74+ 	$ socketPrinceCMD ("RCPT TO: <yourvegasprince@gmail.com> " );
75+ 	echo  $ socketgetResponse ();
76+ 77+ 	$ socketPrinceCMD ("RCPT TO: <yourvegasprince@gmail.com> " );
78+ 	echo  $ socketgetResponse ();
79+ 80+ 	$ socketPrinceCMD ("DATA testing email " );
81+ 	echo  $ socketgetResponse ();
82+ 83+ }
84+ else  {
85+ 	echo  "Not connected  \n\r" ;
86+ 87+ 	echo  $ socketgetResponse (); // S: +OK Password required.	 
88+ }
89+ 90+ ?> 
0 commit comments