skulegirl / django-allauth-sniperlinks

Django app to generate Sniper Links for unverified allauth email addresses, allowing users to find verification emails quickly.
MIT License
7 stars 1 forks source link

Detecting Email Providers at Custom Domain #1

Closed anjanesh closed 1 year ago

anjanesh commented 1 year ago

How does it detect if my-name@my-company.com is at Google Suite which would then have the same GMail link ? Or hosted at Microsoft 365 ?

image

Is there a way to detect providers with custom domains ?

skulegirl commented 1 year ago

It looks up the MX record for the domain to see who hosts their email.

If it's "google.com" or "googlemail.com", and it's a custom domain, then it assumes it uses GSuite and creates the link to their inbox. Same idea if the MX record shows outlook.com for a custom domain.

You can see the code that does all this here.

It's possible that for some MX records it may get the link wrong if there's a special portal for custom domains that I haven't taken into account.

For example, I just did some googling and realize that yahoo small business email has been sold to a company called "Turbify", and any of the yahoodns records with a mx-biz.mail prefix should probably be changed to link to https://mail.turbify.com/. I'd need to get visibility into their webmail interface to see if sniper linking to pull up emails from a given sender is possible. (You can do it on Yahoo, so I would hope so.)

anjanesh commented 1 year ago

Could also check the source of curl https://www.google.com/a/my-domain.com/ServiceLogin and see if there's an error message for non-google workspace domains ?

Would it be faster than checking for MX ?

skulegirl commented 1 year ago

An MX lookup should be just as fast as an HTTP request (likely faster in fact, since HTTP requests require both a DNS lookup and a content request). And MX lookups will give a definitive answer of who hosts the mail server, rather than possibly going through a list of many potential hosts looking for the one that doesn't error.