Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -245,7 +245,7 @@ async def send_email_with_attachment(recipient_email, subject, body, attachment_
|
|
245 |
from fastapi_mail import FastMail, MessageSchema, ConnectionConfig, MessageType
|
246 |
from pydantic import EmailStr, BaseModel
|
247 |
|
248 |
-
|
249 |
|
250 |
conf = ConnectionConfig(
|
251 |
MAIL_USERNAME = "redmind",
|
@@ -272,7 +272,7 @@ async def send_email_with_attachment(recipient_email, subject, body, attachment_
|
|
272 |
await fm.send_message(message)
|
273 |
print("message sent")
|
274 |
|
275 |
-
|
276 |
|
277 |
|
278 |
sender_email = os.getenv("EMAIL_SENDER")
|
@@ -305,7 +305,7 @@ async def send_email_with_attachment(recipient_email, subject, body, attachment_
|
|
305 |
|
306 |
# Send the email
|
307 |
try:
|
308 |
-
with smtplib.SMTP_SSL("smtp.gmail.com",
|
309 |
server.login(sender_email, sender_password)
|
310 |
server.sendmail(sender_email, recipient_email, msg)
|
311 |
print("Email sent successfully")
|
@@ -573,7 +573,8 @@ def answer_question(user_question, chatbot, audio=None):
|
|
573 |
import asyncio
|
574 |
|
575 |
# Send email with the chart image attached
|
576 |
-
coro=
|
|
|
577 |
recipient_email=user_email,
|
578 |
subject="Warehouse Inventory Report",
|
579 |
body=response.get("output", "").split(":")[0],
|
@@ -581,7 +582,7 @@ def answer_question(user_question, chatbot, audio=None):
|
|
581 |
attachment_path=os.getenv("IMAGE_PATH")
|
582 |
)
|
583 |
|
584 |
-
asyncio.run(coro)
|
585 |
|
586 |
|
587 |
if "send email to" in user_question:
|
|
|
245 |
from fastapi_mail import FastMail, MessageSchema, ConnectionConfig, MessageType
|
246 |
from pydantic import EmailStr, BaseModel
|
247 |
|
248 |
+
"""
|
249 |
|
250 |
conf = ConnectionConfig(
|
251 |
MAIL_USERNAME = "redmind",
|
|
|
272 |
await fm.send_message(message)
|
273 |
print("message sent")
|
274 |
|
275 |
+
"""
|
276 |
|
277 |
|
278 |
sender_email = os.getenv("EMAIL_SENDER")
|
|
|
305 |
|
306 |
# Send the email
|
307 |
try:
|
308 |
+
with smtplib.SMTP_SSL("smtp.gmail.com", 2525, context=context) as server:
|
309 |
server.login(sender_email, sender_password)
|
310 |
server.sendmail(sender_email, recipient_email, msg)
|
311 |
print("Email sent successfully")
|
|
|
573 |
import asyncio
|
574 |
|
575 |
# Send email with the chart image attached
|
576 |
+
#coro=
|
577 |
+
send_email_with_attachment(
|
578 |
recipient_email=user_email,
|
579 |
subject="Warehouse Inventory Report",
|
580 |
body=response.get("output", "").split(":")[0],
|
|
|
582 |
attachment_path=os.getenv("IMAGE_PATH")
|
583 |
)
|
584 |
|
585 |
+
#asyncio.run(coro)
|
586 |
|
587 |
|
588 |
if "send email to" in user_question:
|