Message Sender
Sends messages with different services such as email and Google Chat.
Installation
pip install message-sender
Usage
Google Chat
Send messages to Google Chat via webhooks. To set this up, create a "space" in Google Chat, then go to Apps & integrations and create a new webhook.
Sync Client
from message_sender.google_chat import GoogleChatClient
with GoogleChatClient("https://your-webhook-url.com") as client:
client.send_message("Some test message")
Async Client
from message_sender.google_chat import AsyncGoogleChatClient
async with AsyncGoogleChatClient("https://your-webhook-url.com") as client:
await client.send_message("Some test message")
Discord
Send messages to Discord via webhooks. For setup instructions see https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks
Sync Client
from message_sender.discord import DiscordClient
with DiscordClient("https://your-webhook-url.com") as client:
client.send_message("Some test message")
Async Client
from message_sender.discord import AsyncDiscordClient
async with AsyncDiscordClient("https://your-webhook-url.com") as client:
await client.send_message("Some test message")
SMTP Email
Send emails through any SMTP server. Port 465 uses implicit TLS, other ports use STARTTLS.
Sync Client
from message_sender.email.smtp import SMTPClient
client = SMTPClient(
smtp_server="smtp.example.com",
smtp_port=587,
email_from="sender@example.com",
user_name="your-username",
password="your-password",
)
client.send_email(
message="Your message body",
email_to="someone@email.com",
subject="Example",
html_content="<p>Your HTML message body</p>", # optional
)
Async Client
from message_sender.email.smtp import AsyncSMTPClient
client = AsyncSMTPClient(
smtp_server="smtp.example.com",
smtp_port=587,
email_from="sender@example.com",
user_name="your-username",
password="your-password",
)
await client.send_email(
message="Your message body",
email_to="someone@email.com",
subject="Example",
html_content="<p>Your HTML message body</p>", # optional
)
Proton Email
Send emails through Proton Mail's SMTP service. For setup instructions see https://proton.me/support/smtp-submission
Sync Client
from message_sender.email.proton import ProtonEmailClient
client = ProtonEmailClient(email_address="smtp_setup_email@proton.me", smtp_token="your-token")
client.send_email(
message="Your message body",
email_to="someone@email.com",
subject="Example",
html_content="<p>Your HTML message body</p>", # optional
)
Async Client
from message_sender.email.proton import AsyncProtonEmailClient
client = AsyncProtonEmailClient(email_address="smtp_setup_email@proton.me", smtp_token="your-token")
await client.send_email(
message="Your message body",
email_to="someone@email.com",
subject="Example",
html_content="<p>Your HTML message body</p>", # optional
)
Gmail Email
Send emails through Gmail's SMTP service. Requires a Google App Password (not your regular account password), which can be generated from your Google Account settings once 2-Step Verification is enabled.
Sync Client
from message_sender.email.gmail import GmailClient
client = GmailClient(email_address="sender@gmail.com", app_password="your-app-password")
client.send_email(
message="Your message body",
email_to="someone@email.com",
subject="Example",
html_content="<p>Your HTML message body</p>", # optional
)
Async Client
from message_sender.email.gmail import AsyncGmailClient
client = AsyncGmailClient(email_address="sender@gmail.com", app_password="your-app-password")
await client.send_email(
message="Your message body",
email_to="someone@email.com",
subject="Example",
html_content="<p>Your HTML message body</p>", # optional
)
Metadata
Release files for message-sender 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| message_sender-0.4.0.tar.gz | 38.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| message_sender-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 48.7 kB
Release files / message_sender-0.4.0.tar.gz
| Download URL | message_sender-0.4.0.tar.gz |
|---|---|
| Size | 38.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
de8ea045368cd71114a1454e45222513e2ab4d59d842a8af6d9ba450d2a9b619
|
|
BLAKE2b-256 checksum How to use checksums |
4faaad50067fdbddce3e7f64df5d2787d7ce66b95d1b5b7efce8606bd500cdcd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / message_sender-0.4.0-py3-none-any.whl
| Download URL | message_sender-0.4.0-py3-none-any.whl |
|---|---|
| Size | 9.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
52b6183d672b50c01c831cd1fb87a936458957f87396165192ce9778bdbad61a
|
|
BLAKE2b-256 checksum How to use checksums |
5e12d059141c1671166a4a56af90bf27b718dc44a0dcd2bafcf1ed894caa335e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|