diff options
| author | Dennis Fink | 2026-11-12 19:57:08 +0100 |
|---|---|---|
| committer | Dennis Fink | 2026-11-12 19:57:08 +0100 |
| commit | 4bd1d9e348918b2e55db47a1ac3489d035cf55e2 (patch) | |
| tree | f7ed41a374a8a4136792039a262dc62aa8cf8c59 /webmentions_ssg/cli/mail.py | |
| parent | 7035e9f9467684cccae2b7ff3faaa62e6a9f91aa (diff) | |
| download | webmentions-ssg-4bd1d9e348918b2e55db47a1ac3489d035cf55e2.tar.gz webmentions-ssg-4bd1d9e348918b2e55db47a1ac3489d035cf55e2.zip | |
refactor(core): split modules by responsibility
Break up monolithic views, task helpers, networking, CLI, and
application extension setup so each module owns a focused concern.
Reorganize the test suite around the new boundaries while preserving
existing Webmention behavior and coverage.
Diffstat (limited to '')
| -rw-r--r-- | webmentions_ssg/cli/mail.py | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/webmentions_ssg/cli/mail.py b/webmentions_ssg/cli/mail.py deleted file mode 100644 index 47687e2..0000000 --- a/webmentions_ssg/cli/mail.py +++ /dev/null @@ -1,53 +0,0 @@ -# SPDX-FileCopyrightText: 2026 Dennis Fink <me+coding@dennisfink.me> -# -# SPDX-License-Identifier: BSD-3-Clause - -"""Provide a command for testing outgoing email configuration.""" - -import click -from flask import current_app -from flask.cli import AppGroup -from flask_mail import Message - -from .. import MAIL - -MAIL_CLI = AppGroup("mail", help="Handle mail") - - -@MAIL_CLI.command("test", help="Send an email to test the SMTP configuration") -@click.option( - "--to", "recipient", help="Recipient address (defaults to NOTIFICATION_EMAIL)." -) -def send_test_mail(recipient: str | None) -> None: - """ - Send a test email using the configured SMTP server. - - :param recipient: Optional recipient overriding NOTIFICATION_EMAIL. - :raises click.ClickException: If configuration is missing or sending fails. - """ - recipient = recipient or current_app.config.get("NOTIFICATION_EMAIL") - if not recipient: - raise click.ClickException( - "No recipient specified. Set NOTIFICATION_EMAIL or pass --to." - ) - - sender = current_app.config.get("MAIL_DEFAULT_SENDER") - if not sender: - raise click.ClickException("MAIL_DEFAULT_SENDER is not configured.") - - message = Message( - subject="webmentions-ssg: test email", - sender=sender, - recipients=[recipient], - body=( - "This is a test email from webmentions-ssg.\n\n" - "If you received this message, the outgoing mail configuration works.\n" - ), - ) - - try: - MAIL.send(message) - except Exception as exc: - raise click.ClickException(f"Could not send test email: {exc}") from exc - - click.echo(f"Test email sent to {recipient}.") |
