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.0.tar.gz (48.6 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.0-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: message_sender-0.3.0.tar.gz
  • Upload date:
  • Size: 48.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","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.0.tar.gz
Algorithm Hash digest
SHA256 2b12e7c3df31789c38c138f29933da9f9793d19c8359e6cf01808a63576f7efb
MD5 3a9060f859710a538a941100cc1ba275
BLAKE2b-256 30cdc06bd7487e6d60337f2b02ce07ae283f3149b33ac336c59a80a617241dfa

See more details on using hashes here.

File details

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

File metadata

  • Download URL: message_sender-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4878f3625c2a90f969be759b5f004a5dd9b6e590664099a5cd718c2e82e400d6
MD5 2ea0e4d442af36944c6cbd89ae563f6d
BLAKE2b-256 3a41a6d5523013c8c73eff8520720201ed40e38c4b62fed7472f50397021b3fe

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