Ejemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function isValid($email, $checkDNS = false, $strict = false)
 {
     try {
         $this->parser->parse((string) $email);
         $this->warnings = $this->parser->getWarnings();
     } catch (\Exception $e) {
         $rClass = new \ReflectionClass($this);
         $this->error = $rClass->getConstant($e->getMessage());
         return false;
     }
     $dnsProblemExists = $checkDNS ? !$this->checkDNS() : false;
     if ($this->hasWarnings() && (int) max($this->warnings) > $this->threshold) {
         $this->error = self::ERR_DEPREC_REACHED;
         return false;
     }
     return $strict ? !$this->hasWarnings() && !$dnsProblemExists : true;
 }
Ejemplo n.º 2
0
 protected function parse($email)
 {
     parent::parse($email);
     $this->getSCFields();
 }
 /**
  * @param string $text An email as text.
  *
  * @return Email
  */
 public static function read($text)
 {
     $parser = new EmailParser();
     return $parser->parse($text);
 }