diff --git a/esp32/camera/motion-camera/v2-motion-camera/standard.h b/esp32/camera/motion-camera/v2-motion-camera/standard.h index 5023b7b..1d009c2 100644 --- a/esp32/camera/motion-camera/v2-motion-camera/standard.h +++ b/esp32/camera/motion-camera/v2-motion-camera/standard.h @@ -54,6 +54,23 @@ void startWifi() { WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 1); } +void bootNotify() { + + SMTPData smtp; + smtp.setLogin(smtpServer, smtpServerPort, emailSenderAccount, emailSenderPassword); + smtp.setSender("ESP32", emailSenderAccount); + smtp.addRecipient(emailAlertAddress); + smtp.setPriority("High"); + smtp.setSubject("Device Boot: " + (String) deviceName); + smtp.setMessage("

Hello World!

- Sent from ESP32 board

", true); + + if (MailClient.sendMail(smtp)) { + Serial.println("Boot Notification Sent"); + } else Serial.println("Error sending Email, " + MailClient.smtpErrorReason()); + + smtp.empty(); +} + void setTime() { unsigned long nowLong; timeval tv; diff --git a/esp32/camera/motion-camera/v2-motion-camera/v2-motion-camera.ino b/esp32/camera/motion-camera/v2-motion-camera/v2-motion-camera.ino index ecb0b7b..65acdff 100644 --- a/esp32/camera/motion-camera/v2-motion-camera/v2-motion-camera.ino +++ b/esp32/camera/motion-camera/v2-motion-camera/v2-motion-camera.ino @@ -35,6 +35,8 @@ void setup(void) { initHTTP(80); registerCameraServer(81); + bootNotify(); + motionTimer.every(500, timedMotion); } @@ -69,7 +71,7 @@ void send(String path="") { smtp.setSender("ESP32", emailSenderAccount); smtp.addRecipient(emailAlertAddress); smtp.setPriority("High"); - smtp.setSubject("Motion Detected " + path); + smtp.setSubject((String) deviceName + " Motion Detected " + path); smtp.setMessage("

Hello World!

- Sent from ESP32 board

", true); if (path != "") {