Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -270,18 +270,18 @@ def send_email_with_attachment(recipient_email, subject, body, attachment_path):
|
|
| 270 |
|
| 271 |
# Send the email
|
| 272 |
try:
|
| 273 |
-
with smtplib.SMTP_SSL("smtp.gmail.com",
|
| 274 |
server.login(sender_email, sender_password)
|
| 275 |
server.sendmail(sender_email, recipient_email, msg)
|
| 276 |
print("Email sent successfully")
|
| 277 |
except Exception as e:
|
| 278 |
print(f"Error occurred: {str(e)}")
|
| 279 |
-
server = smtplib.SMTP('smtp.gmail.com', 587)
|
| 280 |
server.starttls()
|
| 281 |
server.login(sender_email, sender_password)
|
| 282 |
text = msg.as_string()
|
| 283 |
server.sendmail(sender_email, recipient_email, text)
|
| 284 |
-
server.quit()
|
| 285 |
|
| 286 |
except Exception as error:
|
| 287 |
print(f"An error occurred: {error}")
|
|
|
|
| 270 |
|
| 271 |
# Send the email
|
| 272 |
try:
|
| 273 |
+
with smtplib.SMTP_SSL("smtp.gmail.com", 1024, context=context) as server:
|
| 274 |
server.login(sender_email, sender_password)
|
| 275 |
server.sendmail(sender_email, recipient_email, msg)
|
| 276 |
print("Email sent successfully")
|
| 277 |
except Exception as e:
|
| 278 |
print(f"Error occurred: {str(e)}")
|
| 279 |
+
"""server = smtplib.SMTP('smtp.gmail.com', 587)
|
| 280 |
server.starttls()
|
| 281 |
server.login(sender_email, sender_password)
|
| 282 |
text = msg.as_string()
|
| 283 |
server.sendmail(sender_email, recipient_email, text)
|
| 284 |
+
server.quit()"""
|
| 285 |
|
| 286 |
except Exception as error:
|
| 287 |
print(f"An error occurred: {error}")
|