Skip to main content

No project description provided

Project description

Library for generating and scheduling Email

It allows to send emails using SendGrid or Microsoft Graph.

It also contains certain utils to generate Attachments, eg using Power BI

It does store logs about sent mails in Azure Table Storage to avoid duplicate mails.

from bmsdna.mailing.attachments.static_attachment import StaticAttachment
from bmsdna.mailing.registry import GenerationInfo, daily_mail, TZONE
from datetime import datetime
from bmsdna.mailing import MailMessage
from typing import List
from datetime import time
import polars as pl
from mail_utils import get_unique_id_from_values


@daily_mail(
    "tester",
    "test_mail",
    day_time=time(6, 0, tzinfo=TZONE),
    start_date=datetime(2025, 3, 16, 6, 0, tzinfo=TZONE),
    retry_on_empty_send=False,
)
async def generate_mail(info: GenerationInfo) -> List[MailMessage]:
    return [
        MailMessage(
            entity=info.mail_name,
            subject="Test Mail",
            body="Test Mail",
            to="some_email@other.ch",
            sender="thisisasender@thing.ch",
            attachments=[StaticAttachment(b"Hello World", "test.txt")],
            system=info.system,
            entity_id=get_unique_id_from_values( # if this one is already sent in sendgrid, won't be sent again
                {
                    "mail_name": info.mail_name,
                    "system": info.system,
                    "date": datetime.now().strftime("%Y-%m-%d"),
                }
            ),
            body_is_html=False,
        )
    ]

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

bmsdna_mailing-0.8.5.tar.gz (97.2 kB view details)

Uploaded Source

Built Distribution

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

bmsdna_mailing-0.8.5-py3-none-any.whl (26.7 kB view details)

Uploaded Python 3

File details

Details for the file bmsdna_mailing-0.8.5.tar.gz.

File metadata

  • Download URL: bmsdna_mailing-0.8.5.tar.gz
  • Upload date:
  • Size: 97.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for bmsdna_mailing-0.8.5.tar.gz
Algorithm Hash digest
SHA256 60d53a56e9a1d357e032cc8e341a6922ea866ac185d00cfe2376ae0c4caa4174
MD5 7af2b55ffee7da1ee0c8b9b7acbdd457
BLAKE2b-256 8c5f859056897c389e3a2c3697f48b65fdfcaa31d2c38e1c5082291c59013f60

See more details on using hashes here.

Provenance

The following attestation bundles were made for bmsdna_mailing-0.8.5.tar.gz:

Publisher: python-publish.yml on bmsuisse/bmsdna.mailing

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bmsdna_mailing-0.8.5-py3-none-any.whl.

File metadata

  • Download URL: bmsdna_mailing-0.8.5-py3-none-any.whl
  • Upload date:
  • Size: 26.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for bmsdna_mailing-0.8.5-py3-none-any.whl
Algorithm Hash digest
SHA256 3a2f406b873bcae36c68676476d70df29f4a74d57bf81a3ed3dd772f87a08006
MD5 953818dab1ca8e349c09ce20111cd36f
BLAKE2b-256 50c3666c3cf5f7368a3aae1cff74e776a0ffe04b4d50eda24d20e334c0ba532f

See more details on using hashes here.

Provenance

The following attestation bundles were made for bmsdna_mailing-0.8.5-py3-none-any.whl:

Publisher: python-publish.yml on bmsuisse/bmsdna.mailing

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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