Tuesday, 4 April 2017

Retrieve email server information form an email address

Given an email address, like "user@example.com", I'm trying to ascertain information about the email server they use, information like:

  • Domain
  • Port
  • Uses TLS

Currently, I can split the email address into two parts (for instance user and example.com), then do a MX lookup on the domain in order to attempt to ascertain the mail domain used:

dns.resolveMx(hostname, callback)

However, several hosts seem to use other servers than those (for instance, JustHost encourages all their domains from example.com to justXX.justhost.com in order to provide them with TLS) and attaining those is proving to be tricky.

The port is okay, as long as they use a default port, else as far as I can see it's impossible and TLS is easy to work out as long as I have both the domain and the port in order to contact the server.

Since all these methods seem unreliable at the best of times, are there better methods of ascertaining this information?



via Popey Gilbert

No comments:

Post a Comment