Spaces:
Paused
Paused
CBV01 commited on
Commit ·
a68bdec
1
Parent(s): 84839a3
Fix smtplib uninitialized warning by removing shadowed local imports in favor of global module import
Browse files- backend/main.py +0 -5
backend/main.py
CHANGED
|
@@ -3555,7 +3555,6 @@ def get_email_credentials() -> Dict[str, Any]:
|
|
| 3555 |
|
| 3556 |
def verify_smtp_connection(host: str, port: int, user: str, pwd: str) -> tuple[bool, str]:
|
| 3557 |
"""Tests live connection and authentication against the SMTP server."""
|
| 3558 |
-
import smtplib
|
| 3559 |
clean_user = extract_pure_email(user)
|
| 3560 |
clean_pwd = pwd.strip().replace(" ", "")
|
| 3561 |
if not clean_user or not clean_pwd:
|
|
@@ -3592,10 +3591,6 @@ def send_smtp_email_detailed(to_email: str, subject: str, html_content: str) ->
|
|
| 3592 |
return True, "Simulated delivery (SMTP credentials not configured)"
|
| 3593 |
|
| 3594 |
try:
|
| 3595 |
-
import smtplib
|
| 3596 |
-
from email.mime.multipart import MIMEMultipart
|
| 3597 |
-
from email.mime.text import MIMEText
|
| 3598 |
-
|
| 3599 |
msg = MIMEMultipart("alternative")
|
| 3600 |
msg["Subject"] = subject
|
| 3601 |
msg["From"] = creds["from"]
|
|
|
|
| 3555 |
|
| 3556 |
def verify_smtp_connection(host: str, port: int, user: str, pwd: str) -> tuple[bool, str]:
|
| 3557 |
"""Tests live connection and authentication against the SMTP server."""
|
|
|
|
| 3558 |
clean_user = extract_pure_email(user)
|
| 3559 |
clean_pwd = pwd.strip().replace(" ", "")
|
| 3560 |
if not clean_user or not clean_pwd:
|
|
|
|
| 3591 |
return True, "Simulated delivery (SMTP credentials not configured)"
|
| 3592 |
|
| 3593 |
try:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3594 |
msg = MIMEMultipart("alternative")
|
| 3595 |
msg["Subject"] = subject
|
| 3596 |
msg["From"] = creds["from"]
|