Esempio n. 1
0
 /**
  * @dataProvider invalidEmails
  */
 public function testParseInvalidEmail($email)
 {
     try {
         Utilities::parseEmailAddress($email);
         $this->fail(sprintf('"%s" should not be a valid email', $email));
     } catch (InvalidEmailException $e) {
         return;
     }
 }
Esempio n. 2
0
 /**
  * Check if it's a valid email, ie. not a throwaway email.
  *
  * @param string $email The email to check
  *
  * @return bool true for a throwaway email
  */
 public function isValid($email)
 {
     if (false === ($email = filter_var($email, FILTER_VALIDATE_EMAIL))) {
         return false;
     }
     try {
         list($local, $domain) = Utilities::parseEmailAddress($email);
     } catch (InvalidEmailException $e) {
         return false;
     }
     return !$this->adapter->isThrowawayDomain($domain);
 }