PHPMailer\PHPMailer\PHPMailer::validateAddress
Check that a string looks like an email address.
Validation patterns supported: * `auto` Pick best pattern automatically; * `pcre8` Use the squiloople.com pattern, requires PCRE > 8.0; * `pcre` Use old PCRE implementation; * `php` Use PHP built-in FILTER_VALIDATE_EMAIL; * `html5` Use the pattern given by the HTML5 spec for 'email' type form input elements. * `noregex` Don't use a regex: super fast, really dumb. Alternatively you may pass in a callable to inject your own validator, for example: ```php PHPMailer::validateAddress('user@example.com', function($address) { return (strpos($address, '@') !== false); }); ``` You can also set the PHPMailer::$validator static to a callable, allowing built-in methods to use your validator.
Signature
public function validateAddress(string
$address,
[string|callable
$patternselect = NULL] )
Parameters
$address
— string- The email address to check
$patternselect
— object- Which pattern to use
Returns
- bool