How to Check if Email Id exists or Not
You can validate email id input by your user in application.Email can be validated using :
1) Socket
2) TcpClient
Both comes with System.Net.Sockets namespace
Here' the code and the explanation :
- Socket provides properties and methods for network communication, allowing both synchronous and asynchronous data transfer. More about Sockets : Sockets
- IPAddress[] IPs = Dns.GetHostAddresses(host);
Connecting the socket with port number is very important otherwise it will throw exception.
More about Socket.Connect : Socket.Connect()
- NetworkStream : Provides methods for sending and receiving data over Stream sockets. To create instance of NetworkStream, we must provide a connected socket. Once the network stream is instantiated, we use Write() method to send data to remote host and StreamReader use Read method to receive data arriving from remote host on NetworkStream.
|
This is how we can check If email Id exists or not.
Note : Your ISP might have block Port 25 to refrain spammers . In that case RCPT to command will return 550 even if EmailId exists.
Note : Your ISP might have block Port 25 to refrain spammers . In that case RCPT to command will return 550 even if EmailId exists.
That is why during registration, most websites send an Activation Link mail which helps them recognize that the email Id is valid.
In next posts :
2) How to send Activation Link mail from your application
No comments:
Post a Comment