checks if an address contains a valid e-mail address

@param string $address
@throws MailFormatException
972431
private function validateAddress($address) {
		ArgUtils::valType($address, 'scalar');
		
		$email = self::stripEmail($address);
		
		if (!filter_var($email, FILTER_VALIDATE_EMAIL)) throw new MailFormatException('invalid e-mail address: ' . $address);
	}
560576
protected function formatEmailAddress($address, $title)
    {
        if (!empty($title)) {
            $address = sprintf('"%s" <%s>', $title, $address);
        }
        return $address;
    }
1145565
public function match(AddressInterface $address)
    {
        if ($address->getCountryCode() != $this->countryCode) {
            return false;
        }
        if ($this->administrativeArea && $this->administrativeArea != $address->getAdministrativeArea()) {
            return false;
        }
        if ($this->locality && $this->locality != $address->getLocality()) {
            return false;
        }
        if ($this->dependentLocality && $this->dependentLocality != $address->getDependentLocality()) {
            return false;
        }
        if (!PostalCodeHelper::match($address->getPostalCode(), $this->includedPostalCodes, $this->excludedPostalCodes)) {
            return false;
        }

        return true;
    }
92659
protected function doMailFromCommand($address)
    {
        $address = $this->addressEncoder->encodeString($address);
        $this->executeCommand(
            sprintf("MAIL FROM:<%s>\r\n", $address), [250], $failures, true
            );
    }
119705
public function deleteAddress(Address $address)
    {
        if ($this !== $address->addressable()->first())
            return false;

        return $address->delete();
    }
727682
public function addAddress(AddressInterface $address)
    {
        if ($this->addresses->contains($address)) {
            throw new \InvalidArgumentException('This contact already owns this address');
        }

        $this->addresses->add($address);

        if (!$this->defaultAddress) {
            $this->setDefaultAddress($address);
        }
    }
529776
public function isValid($email)
    {
        if (false === $email = filter_var($email, FILTER_VALIDATE_EMAIL)) {
            return false;
        }

        try {
            list($local, $domain) = Utilities::parseEmailAddress($email);
        } catch (InvalidEmailException $e) {
            return false;
        }

        return !$this->adapter->isThrowawayDomain($domain);
    }
524070
private function cleanAddress($address, $updatableFields)
    {
        if (is_array($address)) {
            /** @var UpdatableFieldsConstructor $updatableFieldsConstructor */
            $updatableFieldsConstructor = oxNew(UpdatableFieldsConstructor::class);
            $cleaner = $updatableFieldsConstructor->getAllowedFieldsCleaner($updatableFields);
            return $cleaner->filterByUpdatableFields($address);
        }

        return $address;
    }
813822
public static function locate($address)
	{
		$ip = false;
		if (filter_var($address, FILTER_VALIDATE_IP))
		{
			$ip = true;
		}

		$adapter  = new \Geocoder\HttpAdapter\CurlHttpAdapter();

		$p = array();

		// Get a list of providers
		if ($providers = \Event::trigger('geocode.onGeocodeProvider', array('geocode.locate', $adapter, $ip)))
		{
			foreach ($providers as $provider)
			{
				if ($provider)
				{
					$p[] = $provider;
				}
			}
		}

		if (!count($p))
		{
			return '';
		}

		// Instantiate the Geocoder service and pass it the list of providers
		$geocoder = new \Geocoder\Geocoder();
		$geocoder->registerProvider(new \Geocoder\Provider\ChainProvider($p));

		// Try to get some data...
		return $geocoder->geocode($address);
	}
1111998
protected static function validateEmailAddress($email) {
		if (empty($email)) {
			throw new InvalidEmailException();
		}

		$email = \trim($email);

		if (!\filter_var($email, \FILTER_VALIDATE_EMAIL)) {
			throw new InvalidEmailException();
		}

		return $email;
	}
685145
public function SetFrom($address, $name = '',$auto=1) {
    $address = trim($address);
    $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim
    if (!self::ValidateAddress($address)) {
      $this->SetError($this->Lang('invalid_address').': '. $address);
      if ($this->exceptions) {
        throw new phpmailerException($this->Lang('invalid_address').': '.$address);
      }
      echo $this->Lang('invalid_address').': '.$address;
      return false;
    }
    $this->From = $address;
    $this->FromName = $name;
    if ($auto) {
      if (empty($this->ReplyTo)) {
        $this->AddAnAddress('ReplyTo', $address, $name);
      }
      if (empty($this->Sender)) {
        $this->Sender = $address;
      }
    }
    return true;
  }
1223920
public void setEnvelopeFrom(String address) throws AddressException {
		if(StringUtils.isEmpty(address)) {
			this.envelopeFrom = address;
		} else {
			InternetAddress tmp = toInternetAddress(address, null);
			this.envelopeFrom = tmp.getAddress();
		}
	}
1022940
protected function hasRecipient($address, $name = null, $property = 'to')
    {
        $expected = $this->normalizeRecipient(
            $this->addressesToArray($address, $name)[0]
        );

        $expected = [
            'name' => $expected->name ?? null,
            'address' => $expected->email,
        ];

        return collect($this->{$property})->contains(function ($actual) use ($expected) {
            if (! isset($expected['name'])) {
                return $actual['address'] == $expected['address'];
            }

            return $actual == $expected;
        });
    }
1327207
public function addAddress(AddressInterface $address): void
    {
        if (!$this->hasAddress($address)) {
            if ($this->isIndividual()) {
                if ($address->getFirstName() === null || $address->getLastName() === null) {
                    $address->setFirstName($this->getFirstName());
                    $address->setLastName($this->getLastName());
                }
            } else {
                if ($address->getLastName() === null) {
                    $address->setLastName($this->getName());
                }
            }

            $this->addresses->add($address);
            $address->setCustomer($this);

            if (!$this->getDefaultAddress()) {
                $this->setDefaultAddress($address);
            }
        }
    }
276666
public function format(Address $address)
    {
        $fields = [
            'p-street-address' => $address->getStreet(),
            'p-extended-address' => $address->getExtended(),
            'p-post-office-box' => $address->getPobox(),
            'p-locality' => $address->getLocality(),
            'p-region' => $address->getRegion(),
            'p-postal-code' => $address->getPostal(),
            'p-country' => $address->getCountry()
        ];
        $tags = [];
        foreach ($fields as $k => $v) {
            if (strlen($v) > 0) {
                $tags[] = '<span class="' . $k . '">' . htmlspecialchars($v) . '</span>';
            }
        }
        $geo = $address->getGeo();
        if ($geo !== null) {
            $tags[] = '<span class="p-geo">' . $this->geoFormatter->format($geo) . '</span>';
        }
        return '<span class="h-adr">' . implode(' ', $tags) . '</span>';
    }
684856
public function setDeliveryAddressInfo(Address $address)
    {
        $this->setDeliveryAddress($address->getAddress());
        $this->setDeliveryPostalCode($address->getPostalCode());
        $this->setDeliveryCity($address->getCity());
        $this->setDeliveryState($address->getState());
        $this->setDeliveryCountry($address->getCountry());
    }
202671
protected function _validateAddress($address)
    {
        $is_group = false;
        $addresses = array();

        if ($address['group']) {
            $is_group = true;

            // Get the group part of the name
            $parts     = explode(':', $address['address']);
            $groupname = $this->_splitCheck($parts, ':');
            $structure = array();

            // And validate the group part of the name.
            if (!$this->_validatePhrase($groupname)){
                $this->error = 'Group name did not validate.';
                return false;
            } else {
                // Don't include groups if we are not nesting
                // them. This avoids returning invalid addresses.
                if ($this->nestGroups) {
                    $structure = new stdClass;
                    $structure->groupname = $groupname;
                }
            }

            $address['address'] = ltrim(substr($address['address'], strlen($groupname . ':')));
        }

        // If a group then split on comma and put into an array.
        // Otherwise, Just put the whole address in an array.
        if ($is_group) {
            while (strlen($address['address']) > 0) {
                $parts       = explode(',', $address['address']);
                $addresses[] = $this->_splitCheck($parts, ',');
                $address['address'] = trim(substr($address['address'], strlen(end($addresses) . ',')));
            }
        } else {
            $addresses[] = $address['address'];
        }

        // Trim the whitespace from all of the address strings.
        array_map('trim', $addresses);

        // Validate each mailbox.
        // Format could be one of: name <geezer@domain.com>
        //                         geezer@domain.com
        //                         geezer
        // ... or any other format valid by RFC 822.
        for ($i = 0; $i < count($addresses); $i++) {
            if (!$this->validateMailbox($addresses[$i])) {
                if (empty($this->error)) {
                    $this->error = 'Validation failed for: ' . $addresses[$i];
                }
                return false;
            }
        }

        // Nested format
        if ($this->nestGroups) {
            if ($is_group) {
                $structure->addresses = $addresses;
            } else {
                $structure = $addresses[0];
            }

        // Flat format
        } else {
            if ($is_group) {
                $structure = array_merge($structure, $addresses);
            } else {
                $structure = $addresses;
            }
        }

        return $structure;
    }