Validate a users email address when using gmail to register

Hmm, should try harder before asking for help 🙂

Was quite simple in the end (right or wrong) it works:

    $domain_array = array('googlemail.com','gmail.com');
    $validemail = is_email($email_to_check);
    $exists_text="";
    if ($validemail):
        $exists = email_exists($email_to_check);
        list($user, $domain) = explode('@', $email_to_check);
        if (!$exists):
            if (strpos($user, '+')) {
                list($username_email, $crap) = explode('+', $user);
                $exists = email_exists($username_email . '@' . $domain);
                $exists_text = __('User account exists with this email address', 'pw_texts');
                $email_to_check = strtolower($username_email . '@' . $domain);// Gmail only recognizes lowercase
            }

        endif;
        if ($exists):
           carry on as before