Files
shihao 16263710d9
Some checks failed
Create and publish Docker images with specific build args / build-main-image (linux/amd64, ubuntu-latest) (push) Has been cancelled
Create and publish Docker images with specific build args / build-main-image (linux/arm64, ubuntu-24.04-arm) (push) Has been cancelled
Create and publish Docker images with specific build args / build-cuda-image (linux/amd64, ubuntu-latest) (push) Has been cancelled
Create and publish Docker images with specific build args / build-cuda-image (linux/arm64, ubuntu-24.04-arm) (push) Has been cancelled
Create and publish Docker images with specific build args / build-cuda126-image (linux/amd64, ubuntu-latest) (push) Has been cancelled
Create and publish Docker images with specific build args / build-cuda126-image (linux/arm64, ubuntu-24.04-arm) (push) Has been cancelled
Create and publish Docker images with specific build args / build-ollama-image (linux/amd64, ubuntu-latest) (push) Has been cancelled
Create and publish Docker images with specific build args / build-ollama-image (linux/arm64, ubuntu-24.04-arm) (push) Has been cancelled
Create and publish Docker images with specific build args / build-slim-image (linux/amd64, ubuntu-latest) (push) Has been cancelled
Create and publish Docker images with specific build args / build-slim-image (linux/arm64, ubuntu-24.04-arm) (push) Has been cancelled
Create and publish Docker images with specific build args / merge-main-images (push) Has been cancelled
Create and publish Docker images with specific build args / merge-cuda-images (push) Has been cancelled
Create and publish Docker images with specific build args / merge-cuda126-images (push) Has been cancelled
Create and publish Docker images with specific build args / merge-ollama-images (push) Has been cancelled
Create and publish Docker images with specific build args / merge-slim-images (push) Has been cancelled
Python CI / Format Backend (3.11.x) (push) Has been cancelled
Python CI / Format Backend (3.12.x) (push) Has been cancelled
Frontend Build / Format & Build Frontend (push) Has been cancelled
Frontend Build / Frontend Unit Tests (push) Has been cancelled
Close inactive issues / close-issues (push) Has been cancelled
feat:新增套餐系统,删除积分制
2026-01-09 17:30:15 +08:00

35 lines
915 B
Python

import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from open_webui.config import (
SMTP_USERNAME,
SMTP_HOST,
SMTP_PORT,
SMTP_PASSWORD,
SMTP_SENT_FROM,
)
def send_email(receiver: str, subject: str, body: str):
message = MIMEMultipart()
message["From"] = SMTP_SENT_FROM.value or SMTP_USERNAME.value
message["To"] = receiver
message["Subject"] = subject
message.attach(MIMEText(body, "html"))
port = str(SMTP_PORT.value)
if port == "587":
server = smtplib.SMTP(SMTP_HOST.value, int(port))
server.starttls()
elif port == "465":
server = smtplib.SMTP_SSL(SMTP_HOST.value, int(port))
else:
raise ValueError(f"Invalid SMTP port {port}")
try:
server.login(SMTP_USERNAME.value, SMTP_PASSWORD.value)
server.send_message(message)
finally:
server.quit()