Beispiel #1
0
 /**
  * {@inheritdocs}
  */
 public function authenticate(Smtp $smtp)
 {
     $smtp->invoke(new Auth($smtp, "LOGIN"));
     $smtp->invoke(new Input($smtp, base64_encode($this->username)));
     if ($smtp->read()->getCode() === Authentication::ACCEPTED) {
         $smtp->invoke(new Input($smtp, base64_encode($this->password)));
         return $smtp->read()->getCode() === Authentication::AUTHENTICATION_PERFORMED;
     }
     return false;
 }
Beispiel #2
0
 /**
  * {@inheritdocs}
  */
 public function authenticate(Smtp $smtp)
 {
     $smtp->invoke(new Auth($smtp, "PLAIN"));
     $smtp->invoke(new Input($smtp, base64_encode(sprintf("%s%s", $this->username, $this->password))));
     return $smtp->read()->getCode() === Authentication::AUTHENTICATION_PERFORMED;
 }