Skip to main content

An ultra-simple and SOLID Python library for sending emails with attachments and HTML or plain text support.

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description

Osmia

An ultra-simple and SOLID Python library for sending emails with attachments and HTML or plain text support.


✨ Features

  • Send emails with plain text or HTML
  • Easily add multiple attachments
  • SOLID-compliant architecture
  • Simple and clean interface
  • sending email to a recipient email list

🚀 Installation

git clone https://github.com/Tina-1300/Osmia.git

or

pip install osmia

example usage of library :

from Osmia.email_message import EmailMessage
from Osmia.email_config import EmailConfig

# Email Configuration
config = EmailConfig(
    smtp_server="smtp.gmail.com", # SMTP server
    smtp_port=587, # SMTP port
    login="email@gmail.com", # sender's email
    password="mot de passe d'application" # application password
)

# Creation of the email
email = EmailMessage(
    config.smtp_server,
    config.smtp_port,
    config.login,
    config.password
)

html_message = """
<html>
    <body>
        <h1 style="color:blue;">Ceci est un test HTML !</h1>
        <p>Envoi d'un email en <b>HTML</b> avec une pièce jointe.</p>
    </body>
</html>
"""

text_message = "Ceci est un test."

format_mail = ["plain", "html"]

files_listes = ["random.hpp", "libcurl-x64.dll"]


# sends the same email to all emails in the to_email list
responses = email.send_email(
    to_email=["destinatere@gmail.com", "destinatere2@gmail.com", "destinatere3@gmail.com"], # recipient email or make a recipient email list
    subject="Test Email html format",
    message=html_message, 
    type_email=str(format_mail[1]), # html => to send in html format, plain => in text format
    list_files=files_listes # 1 or more files it works
)

# we can keep this syntax
response = email.send_email(
    to_email="destinatere@gmail.com", # recipient email or make a recipient email list
    subject="Test Email text format",
    message=text_message, 
    type_email=str(format_mail[0]), # html => to send in html format, plain => in text format
    list_files=files_listes # 1 or more files it works
)

# Please note that sending large files does not work.

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

osmia-1.1.0.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

osmia-1.1.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file osmia-1.1.0.tar.gz.

File metadata

  • Download URL: osmia-1.1.0.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.0

File hashes

Hashes for osmia-1.1.0.tar.gz
Algorithm Hash digest
SHA256 90d2fc4d3cbb8a23c5aa4560c80fe8bf7aa05f9aeafc0df129b314ad368a6d04
MD5 1810b6ed30ac8fb425bc4b9a8cb8644b
BLAKE2b-256 be70a98943df96328a0befe63e3542584b79d016850a30cc9fc7f5c62e2c23b0

See more details on using hashes here.

File details

Details for the file osmia-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: osmia-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.0

File hashes

Hashes for osmia-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 31d22d299ae03538022238f4f3165391cc5604c3555c058a792cff5be3221704
MD5 93ca01979a7d6ae1d41eee403f0f9743
BLAKE2b-256 7958a6dd89dab7e23fc4c6f3137150543184c31ccd6d05b67e005a4894eabf20

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page