webapp1 commited on
Commit
e4e4aa2
·
verified ·
1 Parent(s): 4413f65

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -8
app.py CHANGED
@@ -57,8 +57,8 @@ print("--- BOOT SEQUENCE INITIATED ---", flush=True)
57
  app = Flask(__name__)
58
 
59
  ALERT_EMAIL_SENDER = "gowreeshgowri50@gmail.com"
60
- ALERT_EMAIL_PASSWORD = "oynu ulet pynk xsza".replace(" ", "")
61
- ALERT_EMAIL_RECEIVER = "mcblackdevil12342@gmail.com"
62
  ENABLE_EMAIL_ALERTS = True
63
 
64
  UPLOAD_FOLDER = 'uploads'
@@ -139,12 +139,11 @@ def process_accident_async(stream_id, frame, location, confidence, severity):
139
 
140
  msg.add_attachment(buffer.tobytes(), maintype='image', subtype='jpeg', filename='incident.jpg')
141
 
142
- server = smtplib.SMTP('smtp.gmail.com', 587, timeout=15)
143
- server.ehlo()
144
- server.starttls()
145
- server.login(ALERT_EMAIL_SENDER, ALERT_EMAIL_PASSWORD)
146
- server.send_message(msg)
147
- server.quit()
148
 
149
  print(f"📧 Dispatch Email Sent Successfully for Stream {stream_id}", flush=True)
150
  except Exception as e:
 
57
  app = Flask(__name__)
58
 
59
  ALERT_EMAIL_SENDER = "gowreeshgowri50@gmail.com"
60
+ ALERT_EMAIL_PASSWORD = "umwz indt tjla smzn".replace(" ", "")
61
+ ALERT_EMAIL_RECEIVER = "mcblackdevil12342@gamil.com"
62
  ENABLE_EMAIL_ALERTS = True
63
 
64
  UPLOAD_FOLDER = 'uploads'
 
139
 
140
  msg.add_attachment(buffer.tobytes(), maintype='image', subtype='jpeg', filename='incident.jpg')
141
 
142
+ # FIX: Upgraded to direct SSL on Port 465. This bypasses local VS Code / Windows firewalls that block Port 587.
143
+ context = ssl.create_default_context()
144
+ with smtplib.SMTP_SSL('smtp.gmail.com', 465, context=context, timeout=20) as server:
145
+ server.login(ALERT_EMAIL_SENDER, ALERT_EMAIL_PASSWORD)
146
+ server.send_message(msg)
 
147
 
148
  print(f"📧 Dispatch Email Sent Successfully for Stream {stream_id}", flush=True)
149
  except Exception as e: