ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilMailImapRfc822AddressParser.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2016 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 require_once 'Services/Mail/classes/Address/Parser/class.ilBaseMailRfc822AddressParser.php';
5 
11 {
15  protected function parseAddressString($a_addresses)
16  {
17  require_once 'Services/Mail/classes/class.ilMail.php';
18  $parsed_addresses = imap_rfc822_parse_adrlist($a_addresses, ilMail::ILIAS_HOST);
19 
20  // #18992
21  $valid_parsed_addresses = array_filter($parsed_addresses, function ($address) {
22  return '.SYNTAX-ERROR.' != $address->host;
23  });
24  if ($parsed_addresses != $valid_parsed_addresses) {
25  throw new ilMailException($a_addresses);
26  }
27 
28  require_once 'Services/Mail/classes/Address/class.ilMailAddress.php';
29  return array_map(function ($address) {
30  return new ilMailAddress($address->mailbox, $address->host);
31  }, $valid_parsed_addresses);
32  }
33 }
const ILIAS_HOST
Class ilMailException.
Class ilBaseMailRfc822AddressParser.
Class ilImapMailRfc822AddressParser.
Class ilMailAddress.