Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 = "
|
| 61 |
-
ALERT_EMAIL_RECEIVER = "mcblackdevil12342@
|
| 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 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 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:
|