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
  • adding different SMTP services : Gmail, Orange, SFR, Yahoo, Outlook

🚀 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
from Osmia.smtp_service_config import Gmail

# configuration class of its SMTP provider
gmail = Gmail()

# Email Configuration
config = EmailConfig(
    smtp_server=gmail.server, # SMTP server
    smtp_port=gmail.port, # SMTP port
    login="email@gmail.com", # sender's email
    password="application password" # 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", "nasmdoc.pdf"]


# 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
    email_service=gmail # your SMTP service
)

# 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
    email_service=gmail # your SMTP service
)

# 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.2.0.tar.gz (4.9 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.2.0-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for osmia-1.2.0.tar.gz
Algorithm Hash digest
SHA256 d859eac596fa89182ed0b67b3919dc1739ff2b2f65e6d9f0923733ba8dec1237
MD5 28f80116e4f8fed2adfb8455b55a1e2a
BLAKE2b-256 357fcf09bf1c3fde91bf84045cc13b102e5b5b7e1b7e313555dfc4c4e8679952

See more details on using hashes here.

File details

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

File metadata

  • Download URL: osmia-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 6.5 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fffb1a70876e55d12da50b6aae96030b5c4744db6f6a15b381961612200b12da
MD5 5db5e187ff5440b4429d9d013f642ac0
BLAKE2b-256 872edfddedd2b8fbc12195e5fdbcd697f0aa858729b134a12a310bc457a2a996

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