asp.net mvc 4 - Check if email id is windows live id or not -
i developing mvc4 application , want authenticate application using windows live id. have developed page can invite users, want check if user's email id windows live id or not?
i have tried different things, validating whether email id gmail id or not.
i have tried below code. working gmail, not windows live id
tcpclient tclient = new tcpclient("gmail-smtp-in.l.google.com", 25); string crlf = "\r\n"; byte[] databuffer; string responsestring; networkstream netstream = tclient.getstream(); streamreader reader = new streamreader(netstream); responsestring = reader.readline(); /* perform helo smtp server , response */ databuffer = bytesfromstring("helo kirtanhere" + crlf); netstream.write(databuffer, 0, databuffer.length); responsestring = reader.readline(); databuffer = bytesfromstring("mail from:<yourgmailidhere@gmail.com>" + crlf); netstream.write(databuffer, 0, databuffer.length); responsestring = reader.readline(); /* read response of rcpt message know google if exist or not */ databuffer = bytesfromstring("rcpt to:<" + email.trim() + ">" + crlf); netstream.write(databuffer, 0, databuffer.length); responsestring = reader.readline(); if (getresponsecode(responsestring) == 550) { isexist = false; //response.write("mai address not exist !<br/><br/>"); //response.write("<b><font color='red'>original error smtp server :</font></b>" + responsestring); } /* quite connection */ databuffer = bytesfromstring("quite" + crlf); netstream.write(databuffer, 0, databuffer.length); tclient.close();
is there other way can achieve this?
it depends on how choose authenticate users. if using microsoft apps 2.0 authentication live account has 'tid' claim of ""9188040d-6c67-4c5b-b112-36a304b66dad" while work or school accounts have unique 'tid' claims.
you can view question more information: how determine if email address microsoft 'work or school' account or microsoft account
Comments
Post a Comment