Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -251,7 +251,7 @@ async def send_email_with_attachment(recipient_email, subject, body, attachment_
|
|
| 251 |
MAIL_USERNAME = "redmind",
|
| 252 |
MAIL_PASSWORD = "jymzapycraiheubg",
|
| 253 |
MAIL_FROM = "[email protected]",
|
| 254 |
-
MAIL_PORT =
|
| 255 |
MAIL_SERVER = "smtp.gmail.com",
|
| 256 |
MAIL_FROM_NAME="redmind",
|
| 257 |
MAIL_STARTTLS = True,
|
|
@@ -275,7 +275,6 @@ async def send_email_with_attachment(recipient_email, subject, body, attachment_
|
|
| 275 |
|
| 276 |
|
| 277 |
|
| 278 |
-
"""
|
| 279 |
sender_email = os.getenv("EMAIL_SENDER")
|
| 280 |
sender_password = os.getenv("EMAIL_PASSWORD")
|
| 281 |
# Create a multipart message
|
|
@@ -312,13 +311,12 @@ async def send_email_with_attachment(recipient_email, subject, body, attachment_
|
|
| 312 |
print("Email sent successfully")
|
| 313 |
except Exception as e:
|
| 314 |
print(f"Error occurred: {str(e)}")
|
| 315 |
-
server = smtplib.SMTP('smtp.gmail.com',
|
| 316 |
server.starttls()
|
| 317 |
server.login(sender_email, sender_password)
|
| 318 |
text = msg.as_string()
|
| 319 |
server.sendmail(sender_email, recipient_email, text)
|
| 320 |
-
server.quit()
|
| 321 |
-
|
| 322 |
except Exception as error:
|
| 323 |
print(f"An error occurred: {error}")
|
| 324 |
|
|
|
|
| 251 |
MAIL_USERNAME = "redmind",
|
| 252 |
MAIL_PASSWORD = "jymzapycraiheubg",
|
| 253 |
MAIL_FROM = "[email protected]",
|
| 254 |
+
MAIL_PORT = 2525,
|
| 255 |
MAIL_SERVER = "smtp.gmail.com",
|
| 256 |
MAIL_FROM_NAME="redmind",
|
| 257 |
MAIL_STARTTLS = True,
|
|
|
|
| 275 |
|
| 276 |
|
| 277 |
|
|
|
|
| 278 |
sender_email = os.getenv("EMAIL_SENDER")
|
| 279 |
sender_password = os.getenv("EMAIL_PASSWORD")
|
| 280 |
# Create a multipart message
|
|
|
|
| 311 |
print("Email sent successfully")
|
| 312 |
except Exception as e:
|
| 313 |
print(f"Error occurred: {str(e)}")
|
| 314 |
+
server = smtplib.SMTP('smtp.gmail.com', 2525)
|
| 315 |
server.starttls()
|
| 316 |
server.login(sender_email, sender_password)
|
| 317 |
text = msg.as_string()
|
| 318 |
server.sendmail(sender_email, recipient_email, text)
|
| 319 |
+
server.quit()
|
|
|
|
| 320 |
except Exception as error:
|
| 321 |
print(f"An error occurred: {error}")
|
| 322 |
|