Redmind commited on
Commit
12500db
·
verified ·
1 Parent(s): 8f7f566

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -251,7 +251,7 @@ def send_email_with_attachment(recipient_email, subject, body, image_data):
251
  try:
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")
@@ -261,9 +261,10 @@ def send_email_with_attachment(recipient_email, subject, body, image_data):
261
  msg['From'] = sender_email
262
  msg['To'] = recipient_email
263
  msg['Subject'] = subject
264
-
265
  # Attach the body with the msg instance
266
  msg.attach(MIMEText(body, 'plain'))
 
267
  """
268
  # Open the file to be sent
269
  attachment = open(attachment_path, "rb")
@@ -297,11 +298,15 @@ def send_email_with_attachment(recipient_email, subject, body, image_data):
297
  msg.attach(part)"""
298
 
299
  # Create SMTP session for sending the mail
 
300
  server = smtplib.SMTP('smtp.gmail.com', 587)
301
  server.starttls()
302
  server.login(sender_email, sender_password)
 
303
  text = msg.as_string()
 
304
  server.sendmail(sender_email, recipient_email, text)
 
305
  server.quit()
306
 
307
  except Exception as error:
 
251
  try:
252
  print(recipient_email)
253
  print(subject)
254
+
255
  #print(image_data)
256
  sender_email = os.getenv("EMAIL_SENDER")
257
  sender_password = os.getenv("EMAIL_PASSWORD")
 
261
  msg['From'] = sender_email
262
  msg['To'] = recipient_email
263
  msg['Subject'] = subject
264
+ print(body)
265
  # Attach the body with the msg instance
266
  msg.attach(MIMEText(body, 'plain'))
267
+ print(body)
268
  """
269
  # Open the file to be sent
270
  attachment = open(attachment_path, "rb")
 
298
  msg.attach(part)"""
299
 
300
  # Create SMTP session for sending the mail
301
+ print(body)
302
  server = smtplib.SMTP('smtp.gmail.com', 587)
303
  server.starttls()
304
  server.login(sender_email, sender_password)
305
+ print(body)
306
  text = msg.as_string()
307
+ print(body)
308
  server.sendmail(sender_email, recipient_email, text)
309
+ print(body)
310
  server.quit()
311
 
312
  except Exception as error: