Spaces:
Sleeping
Sleeping
File size: 1,135 Bytes
0e39d80 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | import smtplib
from email.mime.text import MIMEText
from config import SMTP_HOST, SMTP_PASS, SMTP_PORT, SMTP_USER
def send_verification_email(to_email: str, employee_name: str, company_name: str) -> tuple[bool, bool]:
"""Returns (success, demo_mode)."""
if not SMTP_HOST or not SMTP_USER:
return True, True
body = (
f"Dear {company_name} Team,\n\n"
f"We are verifying employment documentation submitted by {employee_name}. "
f"Please confirm whether this individual was employed with your organization "
f"as stated in the experience letter on file.\n\n"
f"Reply YES to confirm or NO to deny.\n\n"
f"— DocVerify AI (automated verification)"
)
msg = MIMEText(body)
msg["Subject"] = f"Employment verification request — {employee_name}"
msg["From"] = SMTP_USER
msg["To"] = to_email
try:
with smtplib.SMTP(SMTP_HOST, SMTP_PORT) as server:
server.starttls()
server.login(SMTP_USER, SMTP_PASS)
server.send_message(msg)
return True, False
except Exception:
return False, False
|