Skip to main content

Simple library for email connection parameters discovery

Project description

maildiscover

Simple python library for email connection parameters discovery

What for?

This library aims to provide a simple way to retrieve email configuration parameters (for SMTP/submission, POP3 and IMAP servers). Currently, it does so implementing the autoconfig Mozilla protocol and a special dns lookup.

NOTE: I also considered trying to implement the autodiscover flow from Microsoft, but I wasn't able to make it work.

How to use it?

Install its latest version from pypi

pip install maildiscover

Then, import it into your project. You can either use the provided get function, that tries all the known methods and returns a merged version of the found data:

import maildiscover

result = maildiscover.get("myself@example.com")

Or you can use any specific method independently

import maildiscover

dns_method = maildiscover.DNSSRV("myself@example.com")
ac_method = maildiscover.Autoconfig("myself@example.com")

dns_result = dns_method.get()
ac_result = ac_method.get()

The method may raise, either if it fails (in such case they raise MethodFailed) or if the provided email is malformed, then they raise MaformedEmail.

In case of success, the returned data is a custom dataclass, that can be converted back to a dict with the to_dict method, with self-explaining fields.

Contacts

If you want to suggest a change or propose a patch, don't hesitate to drop me an email at blallo -|AT|- autistici.org. I am friendly :)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

maildiscover-0.1.0.tar.gz (6.2 kB view hashes)

Uploaded Source

Built Distribution

maildiscover-0.1.0-py3-none-any.whl (7.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page