Skip to main content

No project description provided

Project description

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")

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

cd_email-0.0.1.tar.gz (5.8 kB view hashes)

Uploaded Source

Built Distribution

cd_email-0.0.1-py3-none-any.whl (7.3 kB view hashes)

Uploaded Python 3

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