Problem With Autentication

Hi. I’m using the Swift Mailer extension to send emails and works perfect. Now I’m trying to authenticate the users of my application with the same credentials used for send emails. In UserIdentity component I set this code:




        public function authenticate()

	{

	    $SM = Yii::app()->swiftMailer;

 

	    // Get config

	    $mailHost = 'some.server.com';

	    $mailPort = 25;

	 

	    // New transport

	    $transport = $SM->smtpTransport($mailHost, $mailPort);


	    $transport->setUsername($this->username);

	    $transport->setPassword($this->password);

	    $transport->start();


	    if($transport->isStarted()){

		$this->errorCode=self::ERROR_NONE;

	    }else{

		$this->errorCode=self::ERROR_PASSWORD_INVALID;

	    }


	    $transport->stop();

			

	    return !$this->errorCode;

	}



When a user type good login credentials the users gets authenticated at the moment. But when there are typed wrong login credentials the proccess spends more time but at the end the user is correctly authenticated too. I don’t know why this happen because emails are just sent when correct username and passwords are set up in the transport.

I know this is more a Swift Mailer related question than Yii one, but I need help and I have asked these question in other websites and absolutely nothing.

This idea is incorrect?

Can I do what I want?

Are $transport->start() and $transport->isStarted() useful methods to check if the user was correctly authenticated?