Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Check if email

Comments in 'Plugin Development' started by JackboyPlay, May 8, 2016.

  1. JackboyPlay
    Offline

    JackboyPlay Active Member

    Joined:
    Apr 25, 2015
    Posts:
    507
    Minecraft User:
    JackboyPlay
    If I ahve a command like /mail add [Mail] How can I check that args[1] is an E_Mail?
  2. HotFireyDeath
    Offline

    HotFireyDeath Notable Member Plugin Developer

    Joined:
    Mar 19, 2015
    Posts:
    328
    Plugins:
    1
    Minecraft User:
    HotFireyDeath
    Well, there are a lot of online APIs that you can call to check if the specified email is legitimate.

    Unfortunately, email addresses vary a lot today, so there isn't a efficient way to verify a real email address.
    You may check if it looks like a valid email by checking for the '@' symbol..

    PHP:
    if (!strstr("[email protected]""@")){
    //Not valid email.
    }
    else{
    //Valid email.
    }
    JackboyPlay and Primus like this.
  3. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    You can also try
    PHP:
    if(filter_var("[email protected]"FILTER_VALIDATE_EMAIL)){
            
    // valid address
    }else {
            
    // invalid address
    }
    JackboyPlay, udwarf and HotFireyDeath like this.
  4. JackboyPlay
    Offline

    JackboyPlay Active Member

    Joined:
    Apr 25, 2015
    Posts:
    507
    Minecraft User:
    JackboyPlay
    Thanks

Share This Page

Advertisement