/**
  * Validate the email address
  *
  * @throws Exception
  */
 public function validate()
 {
     if (!PostmanUtils::validateEmail($this->email)) {
         $message = 'Invalid e-mail address: ' . $this->email;
         $logger = new PostmanLogger(get_class($this));
         $logger->warn($message);
         throw new Exception($message);
     }
 }
Пример #2
0
 /**
  * Validate the email address
  *
  * @throws Exception
  */
 public function validate($desc = '')
 {
     if (!PostmanUtils::validateEmail($this->email)) {
         if (empty($desc)) {
             /* Translators: Where %s is the email address */
             $message = sprintf('Invalid e-mail address "%s"', $this->email);
         } else {
             /* Translators: Where (1) is the header name (eg. To) and (2) is the email address */
             $message = sprintf('Invalid "%1$s" e-mail address "%2$s"', $desc, $this->email);
         }
         $logger = new PostmanLogger(get_class($this));
         $logger->warn($message);
         throw new Exception($message);
     }
 }