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
- adding cc and cci (bcc)
🚀 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
bcc="tiers@gmail.com"
#cc="tierse@gmail.com"
)
# 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file osmia-1.3.0.tar.gz.
File metadata
- Download URL: osmia-1.3.0.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8889648c9e964ce19ecb3981c5dd70f5ffe2fb91f5c5634f876180ea56e55ba2
|
|
| MD5 |
6a08f48fb8e31c329a84add0fc3ca508
|
|
| BLAKE2b-256 |
9e9123c9a52456a1c30970668d970ccf14ca3d400bab757dd3211315b746d683
|
File details
Details for the file osmia-1.3.0-py3-none-any.whl.
File metadata
- Download URL: osmia-1.3.0-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6fab6d87b64ec5919b2b9620d7eaffd5f916bfa7d7730957e630298080331e3c
|
|
| MD5 |
2769c9547bdf22ff01e5257790768625
|
|
| BLAKE2b-256 |
ce662beba8446909838d504f4ae1b648bdffd0f767c5a7f4e4ecbad1243b0768
|