. * * The interactive user interfaces in modified source and object code versions * of this program must display Appropriate Legal Notices, as required under * Section 5 of the GNU Affero General Public License version 3. * * In accordance with Section 7(b) of the GNU Affero General Public License version 3, * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ namespace Espo\Modules\Crm\Tools\EmailAddress; use Espo\Core\Utils\File\Manager as FileManager; use Espo\Core\Utils\Json; use RuntimeException; /** * @since 9.0.3 */ class DefaultFreeDomainChecker implements FreeDomainChecker { private string $file = 'application/Espo/Modules/Crm/Resources/data/freeEmailProviderDomains.json'; public function __construct( private FileManager $fileManager ) {} public function check(string $domain): bool { $list = Json::decode($this->fileManager->getContents($this->file)); if (!is_array($list)) { throw new RuntimeException("Bad data in freeEmailProviderDomains file."); } return in_array($domain, $list); } }