Jump to content
  • 0

Blesta invalid email. How to fix?


ZweiTiger

Question

Hello

We got a problem with our Blesta. Blesta says at client registration, user email is invalid. As i know blesta check the user email address and has to be valid. Could you help me to turn off this shit? Many users reported  they cant register, invalid email (gmail address example), then sadly the user is finally created in the database, but not appear in the Blesta admin area.

Blesta 4.1.2

Link to comment
Share on other sites

7 answers to this question

Recommended Posts

  • 0
3 hours ago, Doctrine said:

You not got the point, but you are right. Thats not a problem for now, the problem is the bug. 

It's not a bug, and not something we intend to change. If the email address provided cannot receive email, they will never receive their order information or any other correspondence. This helps a lot of people who misspell their own domain during checkout.

However, if you'd like to disable the DNS check, you can do so by editing ~/vendors/minphp/input/src/Input.php. Look for this:

    /**
     * Checks if the given string is a valid email address
     *
     * @param string $str The string to test
     * @param boolean $check_record True to check DNS/MX record
     * @retrun boolean True if the email is valid, false otherwise
     */
    public static function isEmail($str, $check_record = true)
    {
        $check = array();
        // Verify that the address is formatted correctly
        if (isset($str) && preg_match(
            "/^[a-z0-9!#$%\*\/?\|^\{\}`~&'\+=_.-]+@[a-z0-9.-]+\.[a-z0-9]{1,63}$/Di",
            $str,
            $check
        )) {
            // Verify that the domain is valid
            if ($check_record) {
                // Append "." to the host name to prevent DNS server from creating the record
                $host = substr(strstr($check[0], '@'), 1) . ".";
                $mxhosts = array();
                if (function_exists("getmxrr") && !getmxrr($host, $mxhosts)) {
                    // This will catch DNSs that are not MX
                    if (function_exists("checkdnsrr") && !checkdnsrr($host, "ANY")) {
                        return false;
                    }
                }
            }
            return true;
        }

        return false;
    }

And change to

    /**
     * Checks if the given string is a valid email address
     *
     * @param string $str The string to test
     * @param boolean $check_record True to check DNS/MX record
     * @retrun boolean True if the email is valid, false otherwise
     */
    public static function isEmail($str, $check_record = true)
    {
        $check = array();
        // Verify that the address is formatted correctly
        if (isset($str) && preg_match(
            "/^[a-z0-9!#$%\*\/?\|^\{\}`~&'\+=_.-]+@[a-z0-9.-]+\.[a-z0-9]{1,63}$/Di",
            $str,
            $check
        )) {
            // Verify that the domain is valid
            /* do not check dns
            if ($check_record) {
                // Append "." to the host name to prevent DNS server from creating the record
                $host = substr(strstr($check[0], '@'), 1) . ".";
                $mxhosts = array();
                if (function_exists("getmxrr") && !getmxrr($host, $mxhosts)) {
                    // This will catch DNSs that are not MX
                    if (function_exists("checkdnsrr") && !checkdnsrr($host, "ANY")) {
                        return false;
                    }
                }
            }
            */
            return true;
        }

        return false;
    }

It's possible this is different in your version of Blesta, so it's better if you apply the change rather than copy/paste.

 

 

Link to comment
Share on other sites

  • 0
11 hours ago, Paul said:

Check your /etc/resolv.conf file, there should be DNS caching servers listed here that work. Google public DNS would look like:


8.8.8.8
8.8.4.4

If your server can't do name resolution, you will have many issues, failed email validations are just one of them.

Hello

And there is no way to turn this off? Why Blesta need to check the email address if its valid or not. I dont need this feature.  here is no problem with the server. 

The main Bug is, if you got an invalid email address message, then the user created in the database, but cannot view in the admin area, then if client try to reregister again blesta says: invalid email as the email already exist in the database. Thats a big problem for me..

If i want to register with this email example: hwwrwjrw@fakedomain.com , blesta needs to accept it, because cause many problem for us. And what can i say for the client? Sorry this is a fake email. And what client should answer? Who care? I just want to register and order but your system not accept it.

This is a great feature to prevent SPAM, but with this BUG i dont think it... If you need i could give you a teamviewer access and you could check the bug.

So is there any solution for this?

 

Thanks

Link to comment
Share on other sites

  • 0
1 hour ago, Paul said:

It's not a bug, and not something we intend to change. If the email address provided cannot receive email, they will never receive their order information or any other correspondence. This helps a lot of people who misspell their own domain during checkout.

However, if you'd like to disable the DNS check, you can do so by editing ~/vendors/minphp/input/src/Input.php. Look for this:


    /**
     * Checks if the given string is a valid email address
     *
     * @param string $str The string to test
     * @param boolean $check_record True to check DNS/MX record
     * @retrun boolean True if the email is valid, false otherwise
     */
    public static function isEmail($str, $check_record = true)
    {
        $check = array();
        // Verify that the address is formatted correctly
        if (isset($str) && preg_match(
            "/^[a-z0-9!#$%\*\/?\|^\{\}`~&'\+=_.-]+@[a-z0-9.-]+\.[a-z0-9]{1,63}$/Di",
            $str,
            $check
        )) {
            // Verify that the domain is valid
            if ($check_record) {
                // Append "." to the host name to prevent DNS server from creating the record
                $host = substr(strstr($check[0], '@'), 1) . ".";
                $mxhosts = array();
                if (function_exists("getmxrr") && !getmxrr($host, $mxhosts)) {
                    // This will catch DNSs that are not MX
                    if (function_exists("checkdnsrr") && !checkdnsrr($host, "ANY")) {
                        return false;
                    }
                }
            }
            return true;
        }

        return false;
    }

And change to


    /**
     * Checks if the given string is a valid email address
     *
     * @param string $str The string to test
     * @param boolean $check_record True to check DNS/MX record
     * @retrun boolean True if the email is valid, false otherwise
     */
    public static function isEmail($str, $check_record = true)
    {
        $check = array();
        // Verify that the address is formatted correctly
        if (isset($str) && preg_match(
            "/^[a-z0-9!#$%\*\/?\|^\{\}`~&'\+=_.-]+@[a-z0-9.-]+\.[a-z0-9]{1,63}$/Di",
            $str,
            $check
        )) {
            // Verify that the domain is valid
            /* do not check dns
            if ($check_record) {
                // Append "." to the host name to prevent DNS server from creating the record
                $host = substr(strstr($check[0], '@'), 1) . ".";
                $mxhosts = array();
                if (function_exists("getmxrr") && !getmxrr($host, $mxhosts)) {
                    // This will catch DNSs that are not MX
                    if (function_exists("checkdnsrr") && !checkdnsrr($host, "ANY")) {
                        return false;
                    }
                }
            }
            */
            return true;
        }

        return false;
    }

It's possible this is different in your version of Blesta, so it's better if you apply the change rather than copy/paste.

 

 

Thank You! :)

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...