function auth()
{
/* if the connection is made */
/* changed from "AUTH" to "AUTH LOGIN" by G.Faecke */
//if ( $this->send_cmd('AUTH', '334' ) )
if ( $this->send_cmd('AUTH LOGIN', '334' ) )
{
/* if sending username ok */
if ( $this->send_cmd( base64_encode( $this->user ), '334' ) )
{
/* if sending password ok */
if ( $this->send_cmd( base64_encode( $this->pass ), '235' ) )
{
/* set the authenticated flag and return TRUE */
$this->authenticated = TRUE;
return TRUE;
}
}
}
/* added "AUTH PLAIN" by G.Faecke */
if ( $this->send_cmd('AUTH PLAIN', '334' ) )
{
if ( $this->send_cmd( base64_encode( chr(0) . $this->user . chr(0) . $this->pass), '235' ) )
{
/* set the authenticated flag and return TRUE */
$this->authenticated = TRUE;
return TRUE;
}
}
/* in other case return FALSE */
return FALSE;
}