Skip to main content

Creating a README file is an essential part of documenting your Python project for PyPI and GitHub. A good README should provide clear instructions on how to install, configure, and use your software. Below is a template for your SMTPClient project:


CD Email

cd-email is a Python package that simplifies the process of sending emails via SMTP. It supports sending plain text emails, HTML emails, and emails with attachments. It also uses IMAP to receive emails too.

Features

  • Send plain text and HTML emails.
  • Attach files to your emails.
  • Support for SMTP servers with authentication.
  • Flexible and easy to use.

Installation

To install CD Email, you can use pip:

pip install cd-email

Usage

Import the SMTPClient class from the package and initialize it with your SMTP server details:

from cd_email.send_smtp import SMTPClient

client = SMTPClient("smtp.example.com", 587, "your_username", "your_password")

Sending a Simple Email

To send a simple email, use the send_email method:

client.send_email(
    sender="sender@example.com",
    recipients=["recipient@example.com"],
    subject="Test Subject",
    body_text="This is a simple text email."
)

Sending HTML Email

To send an HTML email, include the body_html parameter:

client.send_email(
    sender="sender@example.com",
    recipients=["recipient@example.com"],
    subject="Test HTML Email",
    body_html="<h1>This is an HTML email</h1>"
)

Sending an Email with Attachments

To send an email with attachments, include the attachments parameter with a list of file paths:

client.send_email(
    sender="sender@example.com",
    recipients=["recipient@example.com"],
    subject="Email with Attachments",
    attachments=["path/to/attachment1.txt", "path/to/attachment2.jpg"]
)

Requirements

  • Python 3.x
  • smtplib and email packages (standard library)

IMAP Python Client

A simple and straightforward IMAP client written in Python for interacting with IMAP servers. This client allows you to login, search, fetch, delete emails, and manage folders on an IMAP server.

Features

  • Connect to an IMAP server with SSL
  • Login and logout
  • Select IMAP folders
  • Search for emails with various criteria
  • Fetch full email content
  • Delete emails
  • List all folders
  • Close selected folder

Installation

Currently, this IMAP client is provided as a standalone Python class. You can integrate it into your project by copying the IMAPClient class from imap_client.py.

Usage

Here's a quick example of how to use the IMAPClient:

from cd_email.read_imap import IMAPClient

# Create an instance of the IMAPClient
client = IMAPClient("imap.example.com")

# Login with your credentials
if client.login("your@email.com", "yourpassword"):
    print("Logged in successfully!")

    # Select a folder (defaults to INBOX)
    client.select_folder("INBOX")

    # Search for all emails
    emails = client.search()

    # Fetch and print the subject of each email
    for email_id in emails:
        email = client.fetch_email(email_id)
        print(f"Subject: {email['subject']}")

    # Remember to logout
    client.logout()
else:
    print("Login failed.")


## Contributing

Contributions are welcome! Please read our [Contributing Guide](CONTRIBUTING.md) for more information.

## License

This project is licensed under the [MIT License](LICENSE).

## More documentation at:
[Code Docta](https://codedocta.com "Code Docta")

Release files for cd-email 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cd-email 0.0.1
File Size Uploaded
cd_email-0.0.1.tar.gz 5.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cd-email 0.0.1
File Interpreter ABI Platform
cd_email-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 13.1 kB

Release files / cd_email-0.0.1.tar.gz

Download URL cd_email-0.0.1.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
724f270261da162b43315a89c8ab3a30dfdb000627f9dcd9d2b8afe6767c06a0
BLAKE2b-256 checksum
How to use checksums
b31e4770095c17a34cc843e111822a18c9e4ea7fa69044bb232a5971671c4b3e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release files / cd_email-0.0.1-py3-none-any.whl

Download URL cd_email-0.0.1-py3-none-any.whl
Size 7.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
820850ee42de60cb6184aaf846e0746ba495a3105ac8acae540ea4649fbe0295
BLAKE2b-256 checksum
How to use checksums
29d7241a789a571890f5d9a10ef3154960c441dbd51b41edd3ef07d073a85a56
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page