How to write a code to check an email is existing or not? For example donkey_sdh123@gmail.com, donkey_sdh123@yahoo.com, or donkey_sdh123@lycos.com all these emails do not ex
It is possible to connect to a remote smtp server via telnet:
http://www.yuki-onna.co.uk/email/smtp.html
The only thing is that many mail servers will not accept smtp (e.g. yahoo), and since information about whether an address is valuable to spammers, making it easy to discover which email addresses exist is not in the interests of any email host.
You can do a basic check on whether the domain exists using ping or other network scans, and you could use the Google API to search for an email address in case it is listed on the internet in the clear. But it's you and all the scammers out there doing the same thing, so it's probably not worth trying.
Another thing to note is that many email providers permit users to provide derivative, temporary or alias addresses, which will work for some limited time or use, but which are not mailboxes themselves. In this circumstance even a checker that worked would think the address did not exist even though the user would receive an email sent to it.
Since expired addresses probably aren't released (to prevent people getting previous users' mail), there will then be sources of false positives (check says yes but is wrong), as well as the false negatives (check says no but is wrong), along with all the friction of being treated like a spammer.