Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -252,7 +252,7 @@ def send_email_with_attachment(recipient_email, subject, body, image_data):
|
|
252 |
print(recipient_email)
|
253 |
print(subject)
|
254 |
print(body)
|
255 |
-
print(image_data)
|
256 |
sender_email = os.getenv("EMAIL_SENDER")
|
257 |
sender_password = os.getenv("EMAIL_PASSWORD")
|
258 |
|
@@ -280,7 +280,7 @@ def send_email_with_attachment(recipient_email, subject, body, image_data):
|
|
280 |
part.add_header('Content-Disposition', f"attachment; filename= {attachment_path}")
|
281 |
|
282 |
# Attach the instance 'part' to instance 'msg'
|
283 |
-
msg.attach(part)
|
284 |
# Create a MIMEBase instance for the attachment
|
285 |
part = MIMEBase('application', 'octet-stream')
|
286 |
|
@@ -294,7 +294,7 @@ def send_email_with_attachment(recipient_email, subject, body, image_data):
|
|
294 |
part.add_header('Content-Disposition', 'attachment; filename="image.png"')
|
295 |
|
296 |
# Attach the instance 'part' to the instance 'msg'
|
297 |
-
msg.attach(part)
|
298 |
|
299 |
# Create SMTP session for sending the mail
|
300 |
server = smtplib.SMTP('smtp.gmail.com', 587)
|
@@ -305,7 +305,7 @@ def send_email_with_attachment(recipient_email, subject, body, image_data):
|
|
305 |
server.quit()
|
306 |
|
307 |
except Exception as error:
|
308 |
-
print(error)
|
309 |
|
310 |
# return 1
|
311 |
|
|
|
252 |
print(recipient_email)
|
253 |
print(subject)
|
254 |
print(body)
|
255 |
+
#print(image_data)
|
256 |
sender_email = os.getenv("EMAIL_SENDER")
|
257 |
sender_password = os.getenv("EMAIL_PASSWORD")
|
258 |
|
|
|
280 |
part.add_header('Content-Disposition', f"attachment; filename= {attachment_path}")
|
281 |
|
282 |
# Attach the instance 'part' to instance 'msg'
|
283 |
+
msg.attach(part)
|
284 |
# Create a MIMEBase instance for the attachment
|
285 |
part = MIMEBase('application', 'octet-stream')
|
286 |
|
|
|
294 |
part.add_header('Content-Disposition', 'attachment; filename="image.png"')
|
295 |
|
296 |
# Attach the instance 'part' to the instance 'msg'
|
297 |
+
msg.attach(part)"""
|
298 |
|
299 |
# Create SMTP session for sending the mail
|
300 |
server = smtplib.SMTP('smtp.gmail.com', 587)
|
|
|
305 |
server.quit()
|
306 |
|
307 |
except Exception as error:
|
308 |
+
print(f"An error occurred: {error}")
|
309 |
|
310 |
# return 1
|
311 |
|