PyMailkit


NamePyMailkit JSON
Version 2.0.1 PyPI version JSON
download
home_pageNone
SummaryA modern Python library for sending and receiving emails with SMTP and IMAP support
upload_time2025-08-12 10:49:46
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT License Copyright (c) [year] [fullname] Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords email smtp imap mail email-client pymail
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # PyMailkit

PyMailkit is a lightweight Python library designed to simplify sending and receiving emails. It provides an easy-to-use interface for interacting with email servers, making it ideal for automation, notifications, and email-based workflows.

[![PyPI Downloads](https://static.pepy.tech/badge/pymailkit)](https://pepy.tech/projects/pymailkit)
[![MIT License](https://img.shields.io/badge/License-MIT-green.svg)](https://choosealicense.com/licenses/mit/)


## Project Structure

- Send emails with attachments and custom headers
- Fetch and filter emails from your inbox
- Simple authentication using app passwords
- Minimal dependencies and easy setup

```
PyMailkit/
├── LICENSE
├── pyproject.toml
├── README.md
├── setup.py
└── src/
    └── pymailkit/
        ├── __init__.py
        ├── auth.py
        ├── receiver.py
        ├── sender.py
        └── tests/
            ├── test_receiver.py
            └── test_sender.py
```


## Installation

Install PyMailkit with pip:

```bash
pip install PyMailkit
```

## Modules

### 1. Sender Module (`pymailkit.sender`)

The sender module allows you to send emails easily, including support for attachments and custom subjects/bodies.

**Key Features:**
- Send plain text or HTML emails
- Add attachments
- Specify sender, recipients, subject, and body

**Example:**

```python
from pymailkit.sender import EmailSender

# Initialize the email sender
mail_server = EmailSender()

# Connect to your email account (prompts for app password)
mail_server.connect(username="example@gmail.com")

# Email details
from_add = "fromsomeone@gmail.com"
to_add = "tosomeone@gmail.com"
sub = "Sample Subject"
body = "Sample body for email sending example"

# Send the email
mail_server.send_email(
    to_addresses=to_add,
    from_address=from_add,
    subject=sub,
    body=body,
    attachments = "/content/sample_data/mnist_test.csv" # Provide absolute path
)

# Close the connection to the server
mail_server.close()
```


### 2. Receiver Module (`pymailkit.receiver`)

The receiver module lets you fetch emails from your inbox, with options to limit the number of emails and filter by criteria.

**Key Features:**
- Fetch emails from inbox
- Limit number of emails retrieved
- Access email metadata (subject, sender, date, body)

**Example:**

```python
from pymailkit.receiver import EmailReceiver

# Initialize the email receiver
mail_server = EmailReceiver()

# Connect to your email account (prompts for app password)
mail_server.connect(username="example@gmail.com")

# Fetch the latest 3 emails
emails = mail_server.fetch_emails(limit=3)

# Print subjects of fetched emails
for email in emails:
    print(email['subject'])

# Close the connection to the server
mail_server.close()
```


## Authors
- [@kailas711](https://github.com/kailas711)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "PyMailkit",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "email, smtp, imap, mail, email-client, pymail",
    "author": null,
    "author_email": "Kailas P S <kailaspsudheer@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/b6/8c/7d5e6d7ce76dc8c5d988a8b436048b1ced7501d716651d31e7443ea5d0bb/pymailkit-2.0.1.tar.gz",
    "platform": null,
    "description": "# PyMailkit\r\n\r\nPyMailkit is a lightweight Python library designed to simplify sending and receiving emails. It provides an easy-to-use interface for interacting with email servers, making it ideal for automation, notifications, and email-based workflows.\r\n\r\n[![PyPI Downloads](https://static.pepy.tech/badge/pymailkit)](https://pepy.tech/projects/pymailkit)\r\n[![MIT License](https://img.shields.io/badge/License-MIT-green.svg)](https://choosealicense.com/licenses/mit/)\r\n\r\n\r\n## Project Structure\r\n\r\n- Send emails with attachments and custom headers\r\n- Fetch and filter emails from your inbox\r\n- Simple authentication using app passwords\r\n- Minimal dependencies and easy setup\r\n\r\n```\r\nPyMailkit/\r\n\u251c\u2500\u2500 LICENSE\r\n\u251c\u2500\u2500 pyproject.toml\r\n\u251c\u2500\u2500 README.md\r\n\u251c\u2500\u2500 setup.py\r\n\u2514\u2500\u2500 src/\r\n    \u2514\u2500\u2500 pymailkit/\r\n        \u251c\u2500\u2500 __init__.py\r\n        \u251c\u2500\u2500 auth.py\r\n        \u251c\u2500\u2500 receiver.py\r\n        \u251c\u2500\u2500 sender.py\r\n        \u2514\u2500\u2500 tests/\r\n            \u251c\u2500\u2500 test_receiver.py\r\n            \u2514\u2500\u2500 test_sender.py\r\n```\r\n\r\n\r\n## Installation\r\n\r\nInstall PyMailkit with pip:\r\n\r\n```bash\r\npip install PyMailkit\r\n```\r\n\r\n## Modules\r\n\r\n### 1. Sender Module (`pymailkit.sender`)\r\n\r\nThe sender module allows you to send emails easily, including support for attachments and custom subjects/bodies.\r\n\r\n**Key Features:**\r\n- Send plain text or HTML emails\r\n- Add attachments\r\n- Specify sender, recipients, subject, and body\r\n\r\n**Example:**\r\n\r\n```python\r\nfrom pymailkit.sender import EmailSender\r\n\r\n# Initialize the email sender\r\nmail_server = EmailSender()\r\n\r\n# Connect to your email account (prompts for app password)\r\nmail_server.connect(username=\"example@gmail.com\")\r\n\r\n# Email details\r\nfrom_add = \"fromsomeone@gmail.com\"\r\nto_add = \"tosomeone@gmail.com\"\r\nsub = \"Sample Subject\"\r\nbody = \"Sample body for email sending example\"\r\n\r\n# Send the email\r\nmail_server.send_email(\r\n    to_addresses=to_add,\r\n    from_address=from_add,\r\n    subject=sub,\r\n    body=body,\r\n    attachments = \"/content/sample_data/mnist_test.csv\" # Provide absolute path\r\n)\r\n\r\n# Close the connection to the server\r\nmail_server.close()\r\n```\r\n\r\n\r\n### 2. Receiver Module (`pymailkit.receiver`)\r\n\r\nThe receiver module lets you fetch emails from your inbox, with options to limit the number of emails and filter by criteria.\r\n\r\n**Key Features:**\r\n- Fetch emails from inbox\r\n- Limit number of emails retrieved\r\n- Access email metadata (subject, sender, date, body)\r\n\r\n**Example:**\r\n\r\n```python\r\nfrom pymailkit.receiver import EmailReceiver\r\n\r\n# Initialize the email receiver\r\nmail_server = EmailReceiver()\r\n\r\n# Connect to your email account (prompts for app password)\r\nmail_server.connect(username=\"example@gmail.com\")\r\n\r\n# Fetch the latest 3 emails\r\nemails = mail_server.fetch_emails(limit=3)\r\n\r\n# Print subjects of fetched emails\r\nfor email in emails:\r\n    print(email['subject'])\r\n\r\n# Close the connection to the server\r\nmail_server.close()\r\n```\r\n\r\n\r\n## Authors\r\n- [@kailas711](https://github.com/kailas711)\r\n",
    "bugtrack_url": null,
    "license": "MIT License\r\n        \r\n        Copyright (c) [year] [fullname]\r\n        \r\n        Permission is hereby granted, free of charge, to any person obtaining a copy\r\n        of this software and associated documentation files (the \"Software\"), to deal\r\n        in the Software without restriction, including without limitation the rights\r\n        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n        copies of the Software, and to permit persons to whom the Software is\r\n        furnished to do so, subject to the following conditions:\r\n        \r\n        The above copyright notice and this permission notice shall be included in all\r\n        copies or substantial portions of the Software.\r\n        \r\n        THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n        SOFTWARE.",
    "summary": "A modern Python library for sending and receiving emails with SMTP and IMAP support",
    "version": "2.0.1",
    "project_urls": {
        "Bug Tracker": "https://github.com/kailasps/pymailkit/issues",
        "Homepage": "https://github.com/kailasps/pymailkit",
        "License": "https://github.com/kailasps/pymailkit/blob/main/LICENSE",
        "Repository": "https://github.com/kailasps/pymailkit.git"
    },
    "split_keywords": [
        "email",
        " smtp",
        " imap",
        " mail",
        " email-client",
        " pymail"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "777d82a31026bd3b4f1ab118ffca5ff3181f4100aa4d0552532f962813cff1bb",
                "md5": "608d8168ab59b9067b95f4be7bc97450",
                "sha256": "2cac1f858c75e1b16a17c9e765893f3a8c6bc7b5b45589e5016230bce29dd685"
            },
            "downloads": -1,
            "filename": "pymailkit-2.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "608d8168ab59b9067b95f4be7bc97450",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 8340,
            "upload_time": "2025-08-12T10:49:44",
            "upload_time_iso_8601": "2025-08-12T10:49:44.453155Z",
            "url": "https://files.pythonhosted.org/packages/77/7d/82a31026bd3b4f1ab118ffca5ff3181f4100aa4d0552532f962813cff1bb/pymailkit-2.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "b68c7d5e6d7ce76dc8c5d988a8b436048b1ced7501d716651d31e7443ea5d0bb",
                "md5": "1059bf34062dc29056df79badb5af9d7",
                "sha256": "4e60e0b0b8211dc06a033f602c61754801e18fce4628ff44050299045f9bf47b"
            },
            "downloads": -1,
            "filename": "pymailkit-2.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "1059bf34062dc29056df79badb5af9d7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 8064,
            "upload_time": "2025-08-12T10:49:46",
            "upload_time_iso_8601": "2025-08-12T10:49:46.087751Z",
            "url": "https://files.pythonhosted.org/packages/b6/8c/7d5e6d7ce76dc8c5d988a8b436048b1ced7501d716651d31e7443ea5d0bb/pymailkit-2.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-12 10:49:46",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "kailasps",
    "github_project": "pymailkit",
    "github_not_found": true,
    "lcname": "pymailkit"
}
        
Elapsed time: 1.86133s