Skip to main content

email autodiscovery

Project description

📩 myl-discovery

myl-discovery is a Python library designed to detect email settings of a given email address or domain.

📥 Installation

To install myl-discovery, run the following command:

pip install myl-discovery

📖 Usage

After installing the package, you can use the autodiscover function to discover the email settings for a domain. Here's an example:

from myldiscovery import autodiscover

settings = autodiscover("yourdomain.com")  # or me@yourdomain.com
print(settings)

# For Exchange autodiscovery you need to provide credentials
settings = autodiscover(
    'me@yourdomain.com', 
    username='WORKGROUP\me', 
    password='mypassword1234'
)

📄 Output

The autodiscover function returns a dictionary with the detected settings. The dictionary contains two keys, imap and smtp, each containing a dictionary with the keys server, port, and starttls.

Here's an example:

{
  "imap": {
    "server": "imap.yourdomain.com",
    "port": 993,
    "starttls": false
  },
  "smtp": {
    "server": "smtp.yourdomain.com",
    "port": 587,
    "starttls": true
  }
}

🧩 Autodiscover Functions

myl-discovery exposes several functions to discover email settings:

  • autodiscover: This function wraps the below function do automatically detect the right settings. (See Autodiscover strategy for more information)
  • autodiscover_srv: This function attempts to resolve SRV records for the domain to discover IMAP and SMTP servers.
  • autodiscover_exchange: This function attempts to use the Exchange Autodiscover service to discover email settings. It requires a username and password.
  • autodiscover_autoconfig: This function attempts to fetch and parse an autoconfig XML file from a URL specified in the domain's TXT records.
  • autodiscover_port_scan: This function performs a port scan on the domain to discover open IMAP and SMTP ports.

🧠 Autodiscover Strategy

The autodiscover function uses the following strategy to discover email settings:

  1. It first attempts to use autodiscover_autoconfig to discover settings from an autoconfig/autodiscover URL specified in the domain's TXT records.
  2. If that fails, it attempts to use autodiscover_srv to discover settings from the domain's SRV records.
  3. If that fails and a password is provided, it attempts to use autodiscover_exchange to discover settings using the Exchange Autodiscover service (only if credentials were provided)
  4. If all else fails, it uses autodiscover_port_scan to discover settings by performing a port scan on the domain.

📜 License

myl-discovery is licensed under the GNU General Public License v3.0.

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

myl-discovery-0.5.4.tar.gz (44.5 kB view details)

Uploaded Source

Built Distribution

myl_discovery-0.5.4-py3-none-any.whl (30.8 kB view details)

Uploaded Python 3

File details

Details for the file myl-discovery-0.5.4.tar.gz.

File metadata

  • Download URL: myl-discovery-0.5.4.tar.gz
  • Upload date:
  • Size: 44.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.1 CPython/3.11.4

File hashes

Hashes for myl-discovery-0.5.4.tar.gz
Algorithm Hash digest
SHA256 35382f71efa743c6f30e9c23fae31c02f74193c31ce1b5061d5be8438bc89fdf
MD5 ee25f8898b60fc3b8942a0b05b859f91
BLAKE2b-256 91456ea9ed955a7503912b589711d0c18c5a005a47cac6876bcc5c896b9dcef6

See more details on using hashes here.

File details

Details for the file myl_discovery-0.5.4-py3-none-any.whl.

File metadata

File hashes

Hashes for myl_discovery-0.5.4-py3-none-any.whl
Algorithm Hash digest
SHA256 b515e46dca5febe3330e5be2bca935f1b59a88d7722f40295f9cf6707666a444
MD5 675d4235ac33e46740c0868c2dce113c
BLAKE2b-256 85357fee3c4d656d01a1d0bf68a794f5c337816b1f9a1914c7e56bf45d1b01d4

See more details on using hashes here.

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