ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilGroupNameAsMailValidator.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2017 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
5 {
7  private $host;
8 
12  public function __construct($host)
13  {
14  $this->host = $host;
15  }
16 
22  public function validate(\ilMailAddress $address)
23  {
24  $groupName = substr($address->getMailbox(), 1);
25 
26  if (ilUtil::groupNameExists($groupName) && $this->isHostValid($address->getHost())) {
27  return true;
28  }
29 
30  return false;
31  }
32 
38  private function isHostValid($host)
39  {
40  return ($host == $this->host || 0 === strlen($host));
41  }
42 }
static groupNameExists($a_group_name, $a_id=0)
checks if group name already exists.
validate(\ilMailAddress $address)
Validates if the given address contains a valid group name to send an email.
isHostValid($host)
Checks if the given host is valid in the email context.
Class ilMailAddress.