diff --git a/sijapi/routers/email.py b/sijapi/routers/email.py index 6707e91..d7c8b3b 100644 --- a/sijapi/routers/email.py +++ b/sijapi/routers/email.py @@ -100,7 +100,7 @@ async def send_response(to_email: str, subject: str, body: str, profile: AutoRes L.DEBUG(f"Sending auto-response to {to_email} concerning {subject} from account {profile.name}...") - server = get_smtp_connection(profile) + server = get_smtp_connection(profile.smtp) L.DEBUG(f"SMTP connection established: {type(server)}") server.login(profile.smtp.username, profile.smtp.password) server.send_message(message) @@ -108,7 +108,6 @@ async def send_response(to_email: str, subject: str, body: str, profile: AutoRes L.INFO(f"Auto-response sent to {to_email} concerning {subject} from account {profile.name}!") return True - except Exception as e: L.ERR(f"Error in preparing/sending auto-response from account {profile.name}: {str(e)}") L.ERR(f"SMTP details - Host: {profile.smtp.host}, Port: {profile.smtp.port}, Encryption: {profile.smtp.encryption}") @@ -123,6 +122,7 @@ async def send_response(to_email: str, subject: str, body: str, profile: AutoRes L.ERR(f"Error closing SMTP connection: {str(e)}") + def clean_email_content(html_content): soup = BeautifulSoup(html_content, "html.parser") return re.sub(r'[ \t\r\n]+', ' ', soup.get_text()).strip()