Verify that email domain exists

前端 未结 5 1347
误落风尘
误落风尘 2021-01-02 05:14

Does anyone check the domain of an email address as part of their verification steps? eg. Confirm that gmail.com exists if the user specified blah@gmail.com as their address

5条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-02 05:53

    You could execute this command in the console

     nslookup -q=mx gmail.com
    

    and parse the output for rows containing MX after the hostname

    gmail.com       MX preference = 40, mail exchanger = alt4.gmail-smtp-in.l.google.com
    gmail.com       MX preference = 20, mail exchanger = alt2.gmail-smtp-in.l.google.com
    gmail.com       MX preference = 5, mail exchanger = gmail-smtp-in.l.google.com
    gmail.com       MX preference = 30, mail exchanger = alt3.gmail-smtp-in.l.google.com
    gmail.com       MX preference = 10, mail exchanger = alt1.gmail-smtp-in.l.google.com
    

    But I wouln't recommend this kind of check in the first place. If a user doesn't want to give you his e-mail address he will always find a way to trick you. The only think you can do is send an email with a verification link.

提交回复
热议问题