Name | dobyemail JSON |
Version |
0.1.6
JSON |
| download |
home_page | https://python.dobyemail.com |
Summary | Do By Email is a comprehensive Python package for handling various email operations. |
upload_time | 2024-10-15 12:56:40 |
maintainer | None |
docs_url | None |
author | Tom Sapletta |
requires_python | >=3.6 |
license | None |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# [DobyEmail](python.dobyemail.com)
DobyEmail is a comprehensive Python package for handling various email operations.
It provides a set of utilities and classes to simplify email-related tasks in your Python projects.
## Features
DobyEmail offers the following key functionalities:
1. **Email Service**: A high-level `Service` class that encapsulates SMTP and IMAP operations for sending and receiving emails.
2. **Email Sending**: The `Sender` class provides methods for composing and sending emails, including support for attachments.
3. **Email Reading**: The `Reader` class allows you to connect to an IMAP server, fetch emails, and parse their content.
4. **Email Transfer**: The `Transfer` class facilitates moving emails between different email accounts or folders.
5. **Date Parsing**: The `parse_date` function helps in converting various date string formats to a standardized format.
6. **Port Checking**: The `check_ports` function allows you to verify if specific ports are open on a given host.
7. **Email Validation**: The `is_valid_email` function provides basic validation for email addresses.
8. **Email Port Configuration**: The `get_email_ports` function retrieves standard email port configurations.
## Installation
```bash
pip install dobyemail
```
## Usage Examples
### Using the Service class
```python
from dobyemail import Service, config
service = Service(
smtp_server=config.smtp_server,
smtp_port=config.smtp_port,
smtp_use_tls=config.smtp_use_tls,
imap_server=config.imap_server,
imap_port=config.imap_port,
imap_use_ssl=config.imap_use_ssl,
username=config.username,
password=config.password
)
# Send an email
service.send_email("recipient@example.com", "Test Subject", "This is a test email.")
# Read emails
emails = service.read_emails(limit=5)
for email in emails:
print(f"From: {email['from']}, Subject: {email['subject']}")
```
### Using the Sender class directly
```python
from dobyemail import Sender
sender = Sender(
smtp_server="smtp.example.com",
smtp_port=587,
use_tls=True,
username="your_username",
password="your_password"
)
# Send a simple email
sender.send_email("recipient@example.com", "Hello", "This is a test email")
# Send an email with attachment
sender.send_email(
"recipient@example.com",
"Email with Attachment",
"Please find the attached document.",
attachments=["path/to/document.pdf"]
)
```
### Using the Reader class directly
```python
from dobyemail import Reader
reader = Reader(
imap_server="imap.example.com",
imap_port=993,
use_ssl=True,
username="your_username",
password="your_password"
)
# Read the latest 10 emails
emails = reader.read_emails(limit=10)
for email in emails:
print(f"Subject: {email['subject']}, From: {email['from']}")
# Search for emails with a specific subject
search_results = reader.search_emails("subject", "Important Meeting")
for email in search_results:
print(f"Found email: {email['subject']}")
```
### Using the Transfer class
```python
from dobyemail import Transfer, Reader, Sender
source_reader = Reader(
imap_server="source_imap.example.com",
imap_port=993,
use_ssl=True,
username="source_username",
password="source_password"
)
destination_sender = Sender(
smtp_server="dest_smtp.example.com",
smtp_port=587,
use_tls=True,
username="dest_username",
password="dest_password"
)
transfer = Transfer(source_reader, destination_sender)
# Transfer the latest 5 emails
transferred_emails = transfer.transfer_emails(limit=5)
print(f"Transferred {len(transferred_emails)} emails")
```
### Utility Functions
```python
from dobyemail import parse_date, check_ports, is_valid_email, get_email_ports
# Parse a date string
print(parse_date("2023-05-15")) # Output: "15-May-2023"
# Check if ports are open
print(check_ports("example.com", [80, 443]))
# Validate an email address
print(is_valid_email("user@example.com")) # Output: True
# Get standard email ports
print(get_email_ports())
```
## Running Tests
To run the unit tests, use the following command from the project root directory:
```bash
python -m unittest discover tests
```
## Configuration
The `email_ports.json` file is used for configuring email ports. It is loaded automatically by the `Config` class in `config.py`. You can modify this file to add or update email port configurations.
## Contributing
Please read CONTRIBUTE.md for details on our code of conduct, and the process for submitting pull requests and publishing to PyPI.
## License
This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.
Raw data
{
"_id": null,
"home_page": "https://python.dobyemail.com",
"name": "dobyemail",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": null,
"author": "Tom Sapletta",
"author_email": "info@softreck.dev",
"download_url": "https://files.pythonhosted.org/packages/60/47/184ec9bc9b041262d43bd1c9b08d2b3336b262114ee0ec7042f37f29c102/dobyemail-0.1.6.tar.gz",
"platform": null,
"description": "# [DobyEmail](python.dobyemail.com)\n\nDobyEmail is a comprehensive Python package for handling various email operations. \nIt provides a set of utilities and classes to simplify email-related tasks in your Python projects.\n\n## Features\n\nDobyEmail offers the following key functionalities:\n\n1. **Email Service**: A high-level `Service` class that encapsulates SMTP and IMAP operations for sending and receiving emails.\n2. **Email Sending**: The `Sender` class provides methods for composing and sending emails, including support for attachments.\n3. **Email Reading**: The `Reader` class allows you to connect to an IMAP server, fetch emails, and parse their content.\n4. **Email Transfer**: The `Transfer` class facilitates moving emails between different email accounts or folders.\n5. **Date Parsing**: The `parse_date` function helps in converting various date string formats to a standardized format.\n6. **Port Checking**: The `check_ports` function allows you to verify if specific ports are open on a given host.\n7. **Email Validation**: The `is_valid_email` function provides basic validation for email addresses.\n8. **Email Port Configuration**: The `get_email_ports` function retrieves standard email port configurations.\n\n## Installation\n\n```bash\npip install dobyemail\n```\n\n## Usage Examples\n\n### Using the Service class\n\n```python\nfrom dobyemail import Service, config\n\nservice = Service(\n smtp_server=config.smtp_server,\n smtp_port=config.smtp_port,\n smtp_use_tls=config.smtp_use_tls,\n imap_server=config.imap_server,\n imap_port=config.imap_port,\n imap_use_ssl=config.imap_use_ssl,\n username=config.username,\n password=config.password\n)\n\n# Send an email\nservice.send_email(\"recipient@example.com\", \"Test Subject\", \"This is a test email.\")\n\n# Read emails\nemails = service.read_emails(limit=5)\nfor email in emails:\n print(f\"From: {email['from']}, Subject: {email['subject']}\")\n```\n\n### Using the Sender class directly\n\n```python\nfrom dobyemail import Sender\n\nsender = Sender(\n smtp_server=\"smtp.example.com\",\n smtp_port=587,\n use_tls=True,\n username=\"your_username\",\n password=\"your_password\"\n)\n\n# Send a simple email\nsender.send_email(\"recipient@example.com\", \"Hello\", \"This is a test email\")\n\n# Send an email with attachment\nsender.send_email(\n \"recipient@example.com\",\n \"Email with Attachment\",\n \"Please find the attached document.\",\n attachments=[\"path/to/document.pdf\"]\n)\n```\n\n### Using the Reader class directly\n\n```python\nfrom dobyemail import Reader\n\nreader = Reader(\n imap_server=\"imap.example.com\",\n imap_port=993,\n use_ssl=True,\n username=\"your_username\",\n password=\"your_password\"\n)\n\n# Read the latest 10 emails\nemails = reader.read_emails(limit=10)\nfor email in emails:\n print(f\"Subject: {email['subject']}, From: {email['from']}\")\n\n# Search for emails with a specific subject\nsearch_results = reader.search_emails(\"subject\", \"Important Meeting\")\nfor email in search_results:\n print(f\"Found email: {email['subject']}\")\n```\n\n### Using the Transfer class\n\n```python\nfrom dobyemail import Transfer, Reader, Sender\n\nsource_reader = Reader(\n imap_server=\"source_imap.example.com\",\n imap_port=993,\n use_ssl=True,\n username=\"source_username\",\n password=\"source_password\"\n)\n\ndestination_sender = Sender(\n smtp_server=\"dest_smtp.example.com\",\n smtp_port=587,\n use_tls=True,\n username=\"dest_username\",\n password=\"dest_password\"\n)\n\ntransfer = Transfer(source_reader, destination_sender)\n\n# Transfer the latest 5 emails\ntransferred_emails = transfer.transfer_emails(limit=5)\nprint(f\"Transferred {len(transferred_emails)} emails\")\n```\n\n### Utility Functions\n\n```python\nfrom dobyemail import parse_date, check_ports, is_valid_email, get_email_ports\n\n# Parse a date string\nprint(parse_date(\"2023-05-15\")) # Output: \"15-May-2023\"\n\n# Check if ports are open\nprint(check_ports(\"example.com\", [80, 443]))\n\n# Validate an email address\nprint(is_valid_email(\"user@example.com\")) # Output: True\n\n# Get standard email ports\nprint(get_email_ports())\n```\n\n## Running Tests\n\nTo run the unit tests, use the following command from the project root directory:\n\n```bash\npython -m unittest discover tests\n```\n\n## Configuration\n\nThe `email_ports.json` file is used for configuring email ports. It is loaded automatically by the `Config` class in `config.py`. You can modify this file to add or update email port configurations.\n\n## Contributing\n\nPlease read CONTRIBUTE.md for details on our code of conduct, and the process for submitting pull requests and publishing to PyPI.\n\n## License\n\nThis project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.\n",
"bugtrack_url": null,
"license": null,
"summary": "Do By Email is a comprehensive Python package for handling various email operations.",
"version": "0.1.6",
"project_urls": {
"Homepage": "https://python.dobyemail.com"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "68e27d0e8042fece13a3e55cbc0e2e99f0656f699a45fd7740c58171ae95bb3c",
"md5": "606ac9c2e68c883d71434467910629e3",
"sha256": "8019e38697df1f39918ba817efdb5cea52cf5568284e7a1f4074e4f4b5269ef8"
},
"downloads": -1,
"filename": "dobyemail-0.1.6-py3-none-any.whl",
"has_sig": false,
"md5_digest": "606ac9c2e68c883d71434467910629e3",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 16242,
"upload_time": "2024-10-15T12:56:39",
"upload_time_iso_8601": "2024-10-15T12:56:39.141938Z",
"url": "https://files.pythonhosted.org/packages/68/e2/7d0e8042fece13a3e55cbc0e2e99f0656f699a45fd7740c58171ae95bb3c/dobyemail-0.1.6-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "6047184ec9bc9b041262d43bd1c9b08d2b3336b262114ee0ec7042f37f29c102",
"md5": "9e99e9482dc8b7b131dd6e6eff08170f",
"sha256": "e5dac18d6fd47696ce8c6c1ce3c048b07ac6334f747462821d93a9dc0abc5df0"
},
"downloads": -1,
"filename": "dobyemail-0.1.6.tar.gz",
"has_sig": false,
"md5_digest": "9e99e9482dc8b7b131dd6e6eff08170f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 18267,
"upload_time": "2024-10-15T12:56:40",
"upload_time_iso_8601": "2024-10-15T12:56:40.838906Z",
"url": "https://files.pythonhosted.org/packages/60/47/184ec9bc9b041262d43bd1c9b08d2b3336b262114ee0ec7042f37f29c102/dobyemail-0.1.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-15 12:56:40",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "dobyemail"
}