Check if Email Exists<\/figcaption><\/figure>\n In this article, you’ll learn how to use the command line to Check if Email Exists<\/strong>, without sending an email. You don’t have to pay for any software or online services and you don’t have to send out test emails. You can do it all for free through the command line, without any limits on how many times you can do it!<\/p>\n<\/p>\n
When you send an email to user@domain.com, the sending mail server will look up the MX record in DNS for ‘domain.com’ and if one or more MX records are found, the sending mail server will try to deliver the email to the mail server specified in the domain.com MX record.<\/p>\n
How to Check if an Email Exists<\/h2>\n Let’s try to verify if the address someuser@gmail.com exists or not. First, we need to find the MX records associated with the recipient’s domain, in our case that is gmail.com. We will use a DNS lookup utility called dig which is installed on most Linux systems. At the command prompt, type:<\/p>\n
$ dig gmail.com MX<\/pre>\nThe output should look something like this:<\/p>\n
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.47.rc1.el6 <<>> gmail.com MX @8.8.8.8\r\n;; global options: +cmd\r\n;; Got answer:\r\n;; - > >HEADER< < - opcode: QUERY, status: NOERROR, id: 32294\r\n;; flags: qr rd ra; QUERY: 1, ANSWER: 5, AUTHORITY: 0, ADDITIONAL: 0\r\n\r\n;; QUESTION SECTION:\r\n;gmail.com. IN MX\r\n\r\n;; ANSWER SECTION:\r\ngmail.com. 3599 IN MX 10 alt1.gmail-smtp-in.l.google.com.\r\ngmail.com. 3599 IN MX 20 alt2.gmail-smtp-in.l.google.com.\r\ngmail.com. 3599 IN MX 30 alt3.gmail-smtp-in.l.google.com.\r\ngmail.com. 3599 IN MX 40 alt4.gmail-smtp-in.l.google.com.\r\ngmail.com. 3599 IN MX 5 gmail-smtp-in.l.google.com.\r\n\r\n;; Query time: 20 msec\r\n;; SERVER: 8.8.8.8#53(8.8.8.8)\r\n;; WHEN: Fri Aug 26 10:13:19 2016\r\n;; MSG SIZE rcvd: 150\r\n;<\/pre>\nWe can notice that there are multiple MX records each with a different preference level value. The smaller the value, the higher the priority. The sending server will first try to deliver the email to the server with the highest priority and in our case, that is ‘gmail-smtp-in.l.google.com’<\/p>\n
Next, we need to connect to the ‘gmail-smtp-in.l.google.com’ mail server on port 25 (SMTP) to confirm the validity of the someuser@gmail.com email address. For this, we can use either telnet or netcat. Both tools are available from the software repositories of most Linux distributions.<\/p>\n
$ nc gmail-smtp-in.l.google.com 25 # or telent gmail-smtp-in.l.google.com 25\r\n220 mx.google.com ESMTP a12si21630825itb.5 - gsmtp\r\n<\/pre>\nTo start the conversation type HELO. Some servers also accept EHLO in place of HELO.<\/p>\n
HELO mydomain.com\r\n250 mx.google.com at your service<\/pre>\nType: mail from:<name@mydomain.com><\/p>\n
mail from:<name@mydomain.com>\r\n250 2.1.0 OK v72si21823782itb.85 - gsmtp<\/pre>\nIf the server responds with “250”, it means that we can proceed further. Next, type: rcpt to:<someuser@gmail.com><\/p>\n
rcpt to:<someuser@gmail.com>\r\n250 2.1.5 OK v72si21823782itb.85 - gsmtp<\/pre>\nThe server response will show us whether the email address “someuser@gmail.com” is valid or not. \nIf you get “250 OK” it means that the email address exists.<\/p>\n
If you get a response of “550” as shown below, it means that email account that you tried to reach does not exist.<\/p>\n
rcpt to:<someuser2345@gmail.com>\r\n550-5.1.1 The email account that you tried to reach does not exist. Please try\r\n550-5.1.1 double-checking the recipient's email address for typos or\r\n550-5.1.1 unnecessary spaces. Learn more at\r\n550 5.1.1 https:\/\/support.google.com\/mail\/answer\/6596 y18si12470464ioi.55 - gsmtp\r\n<\/pre>\nThat\u2019s it! We hope you found this as useful as we did.<\/p>\n
Please note that if you do this repeatedly from the same IP it may lead to a banned IP. Use with caution.<\/p>\n
If you have any questions on how to Check if Email Exists, feel free to comment below or sign up for our hosting services<\/a> and contact our EPIC Support Team<\/a>. They are available 24\/7 and they will take care of your request immediately.<\/p>\n \nPS<\/span><\/strong>. If you liked this post please share it with your friends on the social networks using the sharing buttons or simply leave a reply below. Thanks.<\/p>\n","protected":false},"excerpt":{"rendered":"In this article, you’ll learn how to use the command line to Check if Email Exists, without sending an email. … <\/p>\n
Read More<\/a><\/p>\n","protected":false},"author":4,"featured_media":28719,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1706,21],"tags":[127],"yoast_head":"\nCheck if an Email Exists - RoseHosting<\/title>\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\t \n\t \n\t \n \n \n \n \n \n\t \n\t \n\t \n