mailscout


Namemailscout JSON
Version 0.1.1 PyPI version JSON
download
home_page
SummaryMailScout is a Python library designed for finding business email addresses and simple email validation. It offers a range of tools for email validation, SMTP checks, email normalization, and generating potential business email addresses based on common naming conventions/employee name combinations.
upload_time2024-01-14 17:50:05
maintainer
docs_urlNone
authorBatuhan Akyazı
requires_python>=3.7
license
keywords email marketing email-finder email-validation
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # MailScout - A Python Business Email Finder and Email Validator

MailScout is a Python library designed for finding business email addresses and simple email validation.

It offers a range of tools for email validation, SMTP checks, and generating potential business email addresses based on provided names and common naming conventions.

## Features

- Generate and find potential business email addresses based on provided names and common patterns.
- Check SMTP deliverability of email addresses.
- Detect catch-all domains.
- Normalize names to create email-friendly formats.
- Bulk email finder for multiple domains.

## Installation

Install MailScout using pip:

```bash
pip install mailscout
```

## Initialization

### Initialize the Scout class

```python
from mailscout import Scout
scout = Scout()
```

The **`Scout`** class is the core of the MailScout library, providing various functionalities for email finding, processing and validation. When initializing a **`Scout`** object, you can customize its behavior using several arguments:

### Arguments

- **`check_variants (bool)`**: If set to **`True`**, the Scout object will generate and check different variants of email addresses based on provided names. Defaults to **`True`**.
- `**check_prefixes (bool)**`: Enables the checking of common email prefixes (like 'info', 'contact', etc.) when generating email addresses. This is useful for finding potential business emails. Defaults to `**True**`.
- **`check_catchall (bool)`**: Determines whether the Scout object should check if a domain is a catch-all. A catch-all domain accepts emails sent to any address under that domain. Defaults to **`True`**.
- **`normalize (bool)`**: If set to **`True`**, the Scout object will normalize names to create email-friendly formats. This is particularly useful for names with diacritics or special characters. Defaults to **`True`**.
- **`num_threads (int)`**: Specifies the number of threads to use for concurrent email checking. Increasing the number of threads can speed up the process when checking a large number of emails. Defaults to **`5`**.
- **`num_bulk_threads (int)`**: Sets the number of threads for bulk email finding tasks. This is separate from **`num_threads`** to provide flexibility in handling large-scale operations. Defaults to **`1`**.
- **`smtp_timeout (int)`**: The timeout in seconds for the SMTP connection. This parameter is crucial to avoid long waits on unresponsive servers. Defaults to **`2`**.

## Usage

### Find Business Emails with Names

Mailscout generates combinations using the names you provide. These names should ideally belong to the same person, typically a first name and a last name.

To find business emails, we use the `**find_valid_emails**` method.

Names might be a list of strings.

```python
names = ["Batuhan", "Akyazı"]
# or, names = ["Batuhan Akyazı"]
domain = "example.com"

emails = scout.find_valid_emails(domain, names)

print(emails)
# ['b.akyazi@example.com']
```

You can also provide a list of lists containing strings to check on multiple people.

```python
names = [["Jeff", "Winger"], ["Ben Cheng"], ["Łukas Nowicki"]]
domain = "microsoft.com"

emails = scout.find_valid_emails(domain, names)

print(emails)
# ['jeff@microsoft.com', 'ben.cheng@microsoft.com', 'bencheng@microsoft.com', 'ben@microsoft.com', 'lukas@microsoft.com']
```

Or simply a string.

```python
names = "Jeffrey Tobias Winger"
domain = "microsoft.com"

emails = scout.find_valid_emails(domain, names)

print(emails)
# ['winger.tobias@microsoft.com']
```

### Find Business Emails with Common Prefixes

If you don't provide any names, Mailscout will use brute force on common prefixes to find email addresses.

```python
domain = "microsoft.com"
emails = scout.find_valid_emails(domain)

print(emails)
# ['support@microsoft.com', 'team@microsoft.com', 'marketing@microsoft.com', 'accounts@microsoft.com', 'help@microsoft.com', 'finance@microsoft.com', 'manager@microsoft.com', 'events@microsoft.com', 'community@microsoft.com', 'feedback@microsoft.com', 'dev@microsoft.com', 'developer@microsoft.com', 'status@microsoft.com', 'security@microsoft.com']
```

### Find Business Emails in Bulk

To find valid email addresses in bulk for multiple domains and names, use the `**find_valid_emails_bulk**` method. This function takes a list of dictionaries, each containing a domain and optional names to check, and returns a list of dictionaries, each containing the domain, names, and a list of valid emails found.

You may think of each list item as a task and provide the data accordingly.

Here is an example of how to use this function:

```python
email_data = [
    {"domain": "example.com", "names": ["John Doe"]},
    {"domain": "example.com", "names": ["Jane Smith"]},
		{"domain": "example.com"}
]

valid_emails = scout.find_valid_emails_bulk(email_data)

print(valid_emails)
# [{'domain': 'example.com', 'names': ['John Doe'], 'valid_emails': ['j.doe@example.com']}, {'domain': 'example2.com', 'names': ['Jane Smith'], 'valid_emails': ['j.smith@example2.com', 'jane.smith@example2.com']}, {'domain': 'example.com', 'valid_emails': ['info@example.com']}]

```

## Utility Methods

Mailscout comes with a variety of utility methods for different tasks.

### Check SMTP Deliverability (Email Validation)

To validate an email with Mailscout, use the `**check_smtp**` method.

```python
email = "batuhan@microsoft.com"
is_deliverable = scout.check_smtp(email)

print(f"Email {email} is deliverable: {is_deliverable}")
# Email batuhan@microsoft.com is deliverable: False
```

### Checking for Catch-All Domains

The **`check_email_catchall`** method can be used to determine if a given domain is configured as a catch-all. A catch-all domain is set up to accept emails sent to any address under that domain, even if the specific address does not exist.

```python
domain = "example.com"
is_catchall = scout.check_email_catchall(domain)

print(f"Domain {email} is catch-all: {is_catchall}")
# Email xample.com is catch-all: True
```

### Normalize Names into Email-friendly Format

To normalize a name for an email-friendly format, use the `**normalize_name**` method. This method converts a non-compliant name into a format that is acceptable for an email address. Here are some examples:

```python
name1 = "Şule"
name2 = "Dzirżyterg"

normalized_name1 = scout.normalize_name(name1)
normalized_name2 = scout.normalize_name(name2)

print(normalized_name1)
# 'sule'
print(normalized_name2)
# 'dzirzyterg'

```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "mailscout",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "email,marketing,email-finder,email-validation",
    "author": "Batuhan Akyaz\u0131",
    "author_email": "Batuhan Akyaz\u0131 <batuhanakydev@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/58/b8/e78a9ed6858466e8d4d88e73af37a7924835431905ed7a6b24fb19bf10b0/mailscout-0.1.1.tar.gz",
    "platform": null,
    "description": "# MailScout - A Python Business Email Finder and Email Validator\n\nMailScout is a Python library designed for finding business email addresses and simple email validation.\n\nIt offers a range of tools for email validation, SMTP checks, and generating potential business email addresses based on provided names and common naming conventions.\n\n## Features\n\n- Generate and find potential business email addresses based on provided names and common patterns.\n- Check SMTP deliverability of email addresses.\n- Detect catch-all domains.\n- Normalize names to create email-friendly formats.\n- Bulk email finder for multiple domains.\n\n## Installation\n\nInstall MailScout using pip:\n\n```bash\npip install mailscout\n```\n\n## Initialization\n\n### Initialize the Scout class\n\n```python\nfrom mailscout import Scout\nscout = Scout()\n```\n\nThe **`Scout`** class is the core of the MailScout library, providing various functionalities for email finding, processing and validation. When initializing a **`Scout`** object, you can customize its behavior using several arguments:\n\n### Arguments\n\n- **`check_variants (bool)`**: If set to **`True`**, the Scout object will generate and check different variants of email addresses based on provided names. Defaults to **`True`**.\n- `**check_prefixes (bool)**`: Enables the checking of common email prefixes (like 'info', 'contact', etc.) when generating email addresses. This is useful for finding potential business emails. Defaults to `**True**`.\n- **`check_catchall (bool)`**: Determines whether the Scout object should check if a domain is a catch-all. A catch-all domain accepts emails sent to any address under that domain. Defaults to **`True`**.\n- **`normalize (bool)`**: If set to **`True`**, the Scout object will normalize names to create email-friendly formats. This is particularly useful for names with diacritics or special characters. Defaults to **`True`**.\n- **`num_threads (int)`**: Specifies the number of threads to use for concurrent email checking. Increasing the number of threads can speed up the process when checking a large number of emails. Defaults to **`5`**.\n- **`num_bulk_threads (int)`**: Sets the number of threads for bulk email finding tasks. This is separate from **`num_threads`** to provide flexibility in handling large-scale operations. Defaults to **`1`**.\n- **`smtp_timeout (int)`**: The timeout in seconds for the SMTP connection. This parameter is crucial to avoid long waits on unresponsive servers. Defaults to **`2`**.\n\n## Usage\n\n### Find Business Emails with Names\n\nMailscout generates combinations using the names you provide. These names should ideally belong to the same person, typically a first name and a last name.\n\nTo find business emails, we use the `**find_valid_emails**` method.\n\nNames might be a list of strings.\n\n```python\nnames = [\"Batuhan\", \"Akyaz\u0131\"]\n# or, names = [\"Batuhan Akyaz\u0131\"]\ndomain = \"example.com\"\n\nemails = scout.find_valid_emails(domain, names)\n\nprint(emails)\n# ['b.akyazi@example.com']\n```\n\nYou can also provide a list of lists containing strings to check on multiple people.\n\n```python\nnames = [[\"Jeff\", \"Winger\"], [\"Ben Cheng\"], [\"\u0141ukas Nowicki\"]]\ndomain = \"microsoft.com\"\n\nemails = scout.find_valid_emails(domain, names)\n\nprint(emails)\n# ['jeff@microsoft.com', 'ben.cheng@microsoft.com', 'bencheng@microsoft.com', 'ben@microsoft.com', 'lukas@microsoft.com']\n```\n\nOr simply a string.\n\n```python\nnames = \"Jeffrey Tobias Winger\"\ndomain = \"microsoft.com\"\n\nemails = scout.find_valid_emails(domain, names)\n\nprint(emails)\n# ['winger.tobias@microsoft.com']\n```\n\n### Find Business Emails with Common Prefixes\n\nIf you don't provide any names, Mailscout will use brute force on common prefixes to find email addresses.\n\n```python\ndomain = \"microsoft.com\"\nemails = scout.find_valid_emails(domain)\n\nprint(emails)\n# ['support@microsoft.com', 'team@microsoft.com', 'marketing@microsoft.com', 'accounts@microsoft.com', 'help@microsoft.com', 'finance@microsoft.com', 'manager@microsoft.com', 'events@microsoft.com', 'community@microsoft.com', 'feedback@microsoft.com', 'dev@microsoft.com', 'developer@microsoft.com', 'status@microsoft.com', 'security@microsoft.com']\n```\n\n### Find Business Emails in Bulk\n\nTo find valid email addresses in bulk for multiple domains and names, use the `**find_valid_emails_bulk**` method. This function takes a list of dictionaries, each containing a domain and optional names to check, and returns a list of dictionaries, each containing the domain, names, and a list of valid emails found.\n\nYou may think of each list item as a task and provide the data accordingly.\n\nHere is an example of how to use this function:\n\n```python\nemail_data = [\n    {\"domain\": \"example.com\", \"names\": [\"John Doe\"]},\n    {\"domain\": \"example.com\", \"names\": [\"Jane Smith\"]},\n\t\t{\"domain\": \"example.com\"}\n]\n\nvalid_emails = scout.find_valid_emails_bulk(email_data)\n\nprint(valid_emails)\n# [{'domain': 'example.com', 'names': ['John Doe'], 'valid_emails': ['j.doe@example.com']}, {'domain': 'example2.com', 'names': ['Jane Smith'], 'valid_emails': ['j.smith@example2.com', 'jane.smith@example2.com']}, {'domain': 'example.com', 'valid_emails': ['info@example.com']}]\n\n```\n\n## Utility Methods\n\nMailscout comes with a variety of utility methods for different tasks.\n\n### Check SMTP Deliverability (Email Validation)\n\nTo validate an email with Mailscout, use the `**check_smtp**` method.\n\n```python\nemail = \"batuhan@microsoft.com\"\nis_deliverable = scout.check_smtp(email)\n\nprint(f\"Email {email} is deliverable: {is_deliverable}\")\n# Email batuhan@microsoft.com is deliverable: False\n```\n\n### Checking for Catch-All Domains\n\nThe **`check_email_catchall`** method can be used to determine if a given domain is configured as a catch-all. A catch-all domain is set up to accept emails sent to any address under that domain, even if the specific address does not exist.\n\n```python\ndomain = \"example.com\"\nis_catchall = scout.check_email_catchall(domain)\n\nprint(f\"Domain {email} is catch-all: {is_catchall}\")\n# Email xample.com is catch-all: True\n```\n\n### Normalize Names into Email-friendly Format\n\nTo normalize a name for an email-friendly format, use the `**normalize_name**` method. This method converts a non-compliant name into a format that is acceptable for an email address. Here are some examples:\n\n```python\nname1 = \"\u015eule\"\nname2 = \"Dzir\u017cyterg\"\n\nnormalized_name1 = scout.normalize_name(name1)\nnormalized_name2 = scout.normalize_name(name2)\n\nprint(normalized_name1)\n# 'sule'\nprint(normalized_name2)\n# 'dzirzyterg'\n\n```\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "MailScout is a Python library designed for finding business email addresses and simple email validation. It offers a range of tools for email validation, SMTP checks, email normalization, and generating potential business email addresses based on common naming conventions/employee name combinations.",
    "version": "0.1.1",
    "project_urls": {
        "Homepage": "https://github.com/batuhanaky/mailscout"
    },
    "split_keywords": [
        "email",
        "marketing",
        "email-finder",
        "email-validation"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8be27fb0b2b5c7a54fb0832b56191dd79f3fb6c07ce5815214aa35f96a591015",
                "md5": "3b471a7c0373726d45cf532d7212a662",
                "sha256": "af0d73ee9a547fbfb3e7748d48e7dc6184da1a82dbf5e16618dfdf873a5b23fd"
            },
            "downloads": -1,
            "filename": "mailscout-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3b471a7c0373726d45cf532d7212a662",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 7378,
            "upload_time": "2024-01-14T17:50:02",
            "upload_time_iso_8601": "2024-01-14T17:50:02.992097Z",
            "url": "https://files.pythonhosted.org/packages/8b/e2/7fb0b2b5c7a54fb0832b56191dd79f3fb6c07ce5815214aa35f96a591015/mailscout-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "58b8e78a9ed6858466e8d4d88e73af37a7924835431905ed7a6b24fb19bf10b0",
                "md5": "622ec12533f4a8e62959e8c639166ebb",
                "sha256": "55535d162cf18c4f34fcdc32b01c1ab874c3a2825770e07054ab05f08f6240f7"
            },
            "downloads": -1,
            "filename": "mailscout-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "622ec12533f4a8e62959e8c639166ebb",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 8232,
            "upload_time": "2024-01-14T17:50:05",
            "upload_time_iso_8601": "2024-01-14T17:50:05.625119Z",
            "url": "https://files.pythonhosted.org/packages/58/b8/e78a9ed6858466e8d4d88e73af37a7924835431905ed7a6b24fb19bf10b0/mailscout-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-14 17:50:05",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "batuhanaky",
    "github_project": "mailscout",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "mailscout"
}
        
Elapsed time: 0.16248s