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

Uploaded Python 3

File details

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

File metadata

  • Download URL: message_sender-0.3.1.tar.gz
  • Upload date:
  • Size: 51.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","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.1.tar.gz
Algorithm Hash digest
SHA256 0a492dbc1aa46cfaad3adc75643e91268b0ab9800a3a2643e26eb36a7386a52a
MD5 6fccd9e7f67ad8df6836b3aa485e0252
BLAKE2b-256 10daddf30a362195b5c97810a98183c1cf887544eed0fde1836cdd8a806d9d82

See more details on using hashes here.

File details

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

File metadata

  • Download URL: message_sender-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 758754f0aa20ee9672ea775ab81daa5b5588d8bc899823b1f48d0bf094c6c9b9
MD5 d2592ce987e11031d03d1afae12253a4
BLAKE2b-256 80482b1d6d41af306bf5f3b7f35bf5c8a766d698c148b1064487e10b402930e5

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