Skip to main content

Sends Messages with different services such as email

Project description

Message Sender

Tests Status pre-commit.ci status Coverage PyPI version PyPI - Python Version

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
)

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

message_sender-0.3.2.tar.gz (55.3 kB view details)

Uploaded Source

Built Distribution

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

message_sender-0.3.2-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file message_sender-0.3.2.tar.gz.

File metadata

  • Download URL: message_sender-0.3.2.tar.gz
  • Upload date:
  • Size: 55.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","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}

File hashes

Hashes for message_sender-0.3.2.tar.gz
Algorithm Hash digest
SHA256 efd9c9eb2921f73efc950be724b130dabf156f73aaf27b6a142a498862da2329
MD5 9ef8a0fe945c70a7188f2b8866c09e68
BLAKE2b-256 88a2432d94c5cc4c54b761ddbb512620e98548cd6c576f6490b0e1a57af79dfa

See more details on using hashes here.

File details

Details for the file message_sender-0.3.2-py3-none-any.whl.

File metadata

  • Download URL: message_sender-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","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}

File hashes

Hashes for message_sender-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ddcc0e4badaa057112d59de06194cbb698854a69b1373b1dc20f8220037094f5
MD5 9251856fbe41e4f4841fc338ae7d81a0
BLAKE2b-256 ea3df94bf00eee1c396810c61868c3512070597111de2c5d735badf2c62d1738

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