mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-04-08 03:48:14 +02:00
Tiny Mail From Fix (#953)
This commit is contained in:
parent
621967d2b6
commit
f5be0cc2c0
@ -31,6 +31,7 @@ from danswer.auth.schemas import UserCreate
|
||||
from danswer.auth.schemas import UserRole
|
||||
from danswer.configs.app_configs import AUTH_TYPE
|
||||
from danswer.configs.app_configs import DISABLE_AUTH
|
||||
from danswer.configs.app_configs import EMAIL_FROM
|
||||
from danswer.configs.app_configs import REQUIRE_EMAIL_VERIFICATION
|
||||
from danswer.configs.app_configs import SECRET
|
||||
from danswer.configs.app_configs import SESSION_EXPIRE_TIME_SECONDS
|
||||
@ -38,7 +39,6 @@ from danswer.configs.app_configs import SMTP_PASS
|
||||
from danswer.configs.app_configs import SMTP_PORT
|
||||
from danswer.configs.app_configs import SMTP_SERVER
|
||||
from danswer.configs.app_configs import SMTP_USER
|
||||
from danswer.configs.app_configs import MAIL_FROM
|
||||
from danswer.configs.app_configs import VALID_EMAIL_DOMAINS
|
||||
from danswer.configs.app_configs import WEB_DOMAIN
|
||||
from danswer.configs.constants import AuthType
|
||||
@ -108,11 +108,16 @@ def verify_email_domain(email: str) -> None:
|
||||
)
|
||||
|
||||
|
||||
def send_user_verification_email(user_email: str, token: str) -> None:
|
||||
def send_user_verification_email(
|
||||
user_email: str,
|
||||
token: str,
|
||||
mail_from: str = EMAIL_FROM,
|
||||
) -> None:
|
||||
msg = MIMEMultipart()
|
||||
msg["Subject"] = "Danswer Email Verification"
|
||||
msg["To"] = user_email
|
||||
msg["From"] = MAIL_FROM
|
||||
if mail_from:
|
||||
msg["From"] = mail_from
|
||||
|
||||
link = f"{WEB_DOMAIN}/auth/verify-email?token={token}"
|
||||
|
||||
|
@ -81,7 +81,7 @@ SMTP_SERVER = os.environ.get("SMTP_SERVER") or "smtp.gmail.com"
|
||||
SMTP_PORT = int(os.environ.get("SMTP_PORT") or "587")
|
||||
SMTP_USER = os.environ.get("SMTP_USER", "your-email@gmail.com")
|
||||
SMTP_PASS = os.environ.get("SMTP_PASS", "your-gmail-password")
|
||||
MAIL_FROM = os.environ.get("EMAIL_FROM", SMTP_USER)
|
||||
EMAIL_FROM = os.environ.get("EMAIL_FROM") or SMTP_USER
|
||||
|
||||
|
||||
#####
|
||||
|
@ -27,7 +27,7 @@ services:
|
||||
- SMTP_PORT=${SMTP_PORT:-587} # For sending verification emails, if unspecified then defaults to '587'
|
||||
- SMTP_USER=${SMTP_USER:-}
|
||||
- SMTP_PASS=${SMTP_PASS:-}
|
||||
- MAIL_FROM=${MAIL_FROM:-}
|
||||
- EMAIL_FROM=${EMAIL_FROM:-}
|
||||
# Gen AI Settings
|
||||
- GEN_AI_MODEL_PROVIDER=${GEN_AI_MODEL_PROVIDER:-openai}
|
||||
- GEN_AI_MODEL_VERSION=${GEN_AI_MODEL_VERSION:-gpt-3.5-turbo}
|
||||
|
@ -47,8 +47,8 @@ SECRET=
|
||||
# The below are only needed if you aren't using gmail as your SMTP
|
||||
#SMTP_SERVER=
|
||||
#SMTP_PORT=
|
||||
# when missing SMTP_USER used instead
|
||||
#MAIL_FROM=
|
||||
# When missing SMTP_USER, this is used instead
|
||||
#EMAIL_FROM=
|
||||
|
||||
# OpenID Connect (OIDC)
|
||||
#OPENID_CONFIG_URL=
|
||||
|
@ -11,7 +11,7 @@ data:
|
||||
SMTP_PORT: "" # For sending verification emails, if unspecified then defaults to '587'
|
||||
SMTP_USER: "" # 'your-email@company.com'
|
||||
SMTP_PASS: "" # 'your-gmail-password'
|
||||
MAIL_FROM: "" # 'your-email@company.com' SMTP_USER missing used instead
|
||||
EMAIL_FROM: "" # 'your-email@company.com' SMTP_USER missing used instead
|
||||
# Gen AI Settings
|
||||
GEN_AI_MODEL_PROVIDER: "openai"
|
||||
GEN_AI_MODEL_VERSION: "gpt-3.5-turbo" # Use GPT-4 if you have it
|
||||
|
Loading…
x
Reference in New Issue
Block a user