check is mail vaild
#1

hi guys so i have this code :
Код:
stock IsValidMailAddr(const addr[])
{
    new len = strlen( addr ),
        atcount = ( 0 ), IsValid = false
    ;
    if( len < 5 ){
        IsValid = false;
        goto IsValidMailAddr__the_end;
    }
    for(new i, j=len; i<j; i++){
        if( addr[i] == '@' ) atcount ++;
        if( atcount > 1 ){
            IsValid = false;
            break;
        }

        if( ( addr[i] >= 'a' && addr[i] <= 'z' ) || ( addr[i] >= 'A' && addr[i] <= 'Z' ) || ( addr[i] == '.' ) || ( addr[i] == '_' ) || ( addr[i] == '-' ) )
            IsValid = true;
        else{
            if( ( addr[i] != '@' ) ){
                IsValid = false;
                break;
            }
        }

        if( i + 1 == len )
            if( ( ( addr[i] >= 'a' && addr[i] <= 'z' ) || ( addr[i] >= 'A' && addr[i] <= 'Z' ) ) && ( addr[i] != '.' ) )
                IsValid = true;
        if( i + 1 == len && addr[i] == '.' )
            IsValid = false;
    }
    IsValidMailAddr__the_end:
    return IsValid ? true : false;
}
(by Shinja)

so i want to it just support this providers : yahoo , gmail , hotmail and just this : .com , .us , .org can you please "edit" this code for me ?
Reply


Messages In This Thread
check is mail vaild - by PoniStar - 16.11.2018, 04:37
Re: check is mail vaild - by NaS - 16.11.2018, 05:23
Re: check is mail vaild - by PoniStar - 16.11.2018, 06:06

Forum Jump:


Users browsing this thread: 1 Guest(s)