send_email (sender.py)

OpenOutreach · openoutreach/emails/sender.py · python · Apache-2.0
email, tag:mailbox-credentials

Sends a single outbound email using SMTP credentials from a Mailbox.

# Source: https://github.com/eracle/OpenOutreach | License: Apache-2.0
# Provided via justclaw.it.com; keep this notice with the code.
# openoutreach/emails/sender.py
"""Send one outbound email through a Mailbox's SMTP credentials.

No error handling by design: a failed send raises and the EMAIL task is marked
FAILED by the daemon, then retried on the next cycle. The mailbox is left
untouched — re-import with fixed credentials to repair a dead box.
"""
from __future__ import annotations

import logging
import smtplib
from email.message import EmailMessage
from email.utils import make_msgid

from django.utils import timezone

logger = logging.getLogger(__name__)

SMTP_TIMEOUT_SECONDS = 30


def send_email(
    mailbox,
    to_address: str,
    subject: str,
    body: str,
    *,
    campaig

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key