Support » Plugin: WP Mail SMTP by WPForms » PHP 5.3 – ereg() deprecated

  • If your server is running PHP 5.3+, you’ll get a deprecation notice when ereg() is called on line 351 of wp_mail_smtp.php. This can be fixed by replacing the regex email check with PHP’s built-in filter_var() function for checking emails:

    // replace the following on lines 351-353
    if (preg_match('^[-!#$%&\'*+\\./0-9=?A-Z^_a-z{|}~]+'.'@'.
            '[-!#$%&\'*+\\./0-9=?A-Z^_a-z{|}~]+$', $email))
    // change to:
    if (filter_var($email, FILTER_VALIDATE_EMAIL))

  • The topic ‘PHP 5.3 – ereg() deprecated’ is closed to new replies.