diff --git a/app/main.py b/app/main.py index 0d843bc..69b4602 100644 --- a/app/main.py +++ b/app/main.py @@ -142,6 +142,10 @@ SMTP_USERNAME = os.environ.get("CLOUDRON_MAIL_SMTP_USERNAME", "") SMTP_PASSWORD = os.environ.get("CLOUDRON_MAIL_SMTP_PASSWORD", "") MAIL_FROM = os.environ.get("CLOUDRON_MAIL_FROM", "info@inference.coop") MAIL_FROM_NAME = os.environ.get("CLOUDRON_MAIL_FROM_DISPLAY_NAME", "Inference Cooperative") +# Reply-to address. The sendmail addon only authorizes sending from the app's +# own address (portal.app@inference.coop), so the From header is pinned there; +# we set Reply-To so member replies land at the co-op inbox instead. +MAIL_REPLY_TO = os.environ.get("MAIL_REPLY_TO", "info@inference.coop") # Public base URL for the portal (used in email links). PORTAL_BASE = os.environ.get("PORTAL_BASE", "https://portal.inference.coop") @@ -284,6 +288,7 @@ def send_email(to: str, subject: str, text_body: str, html_body: str | None = No msg["From"] = f"{MAIL_FROM_NAME} <{MAIL_FROM}>" msg["To"] = to msg["Subject"] = subject + msg["Reply-To"] = MAIL_REPLY_TO msg.attach(MIMEText(text_body, "plain", "utf-8")) if html_body: msg.attach(MIMEText(html_body, "html", "utf-8"))