PHPMailer::validateAddress

Advertisement

Summery Summery

Check that a string looks like an email address.

Syntax Syntax

PHPMailer::validateAddress( string $address, string|callable $patternselect = null )

Parameters Parameters

$address

(string) (Required) The email address to check

$patternselect

(string|callable) (Optional) A selector for the validation pattern to use :
* auto Pick best pattern automatically;
* pcre8 Use the squiloople.com pattern, requires PCRE > 8.0, PHP >= 5.3.2, 5.2.14;
* 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: 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.

Default value: null

Return Return

(boolean)

Source Source

File: wp-includes/class-phpmailer.php


			

Advertisement

Advertisement

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.