ESP32 cam Send image to Gmail

Kishore Taran Tech
Kishore Taran Tech
2.8 هزار بار بازدید - 2 سال پیش - ESP32 camera capture image and
ESP32 camera capture image and then send that image to gmail account. whenever PIR sensor detect a motion the ESP32 camera capture a image and send it to gmail id inbox automatically.
Step1: First create a google script web app and the copy the ID
Step2: That ID used to in arduino code.
Web app code: script.google.com/home
code :
function doPost(e) {
 var myRecipient = decodeURIComponent(e.parameter.myRecipient);
 var mySubject = decodeURIComponent(e.parameter.mySubject);
 var myBody = new Date().toString();
 var myFile = e.parameter.myFile;

 var contentType = myFile.substring(myFile.indexOf(":")+1, myFile.indexOf(";"));
 var data = myFile.substring(myFile.indexOf(",")+1);
 data = Utilities.base64Decode(data);
 var blob = Utilities.newBlob(data, contentType, "esp32-cam.jpg");

 // Send a photo as an attachment by using Gmail
 var response = GmailApp.sendEmail(myRecipient, mySubject, myBody,{
     attachments: [blob],
     name: 'Automatic Emailer Script'
   }
 );
 
 // Save the photo to Google Drive
 var folder, folders = DriveApp.getFoldersByName("ESP32-CAM");
 if (folders.hasNext()) {
   folder = folders.next();
 } else {
   folder = DriveApp.createFolder("ESP32-CAM");
 }
 var file = folder.createFile(blob);    
 file.setDescription("Uploaded by ESP32-CAM");
 
 return  ContentService.createTextOutput(response);
}
________________________________________________________________________________
Arduino Code:
https://drive.google.com/file/d/1A2FI...
2 سال پیش در تاریخ 1400/11/28 منتشر شده است.
2,822 بـار بازدید شده
... بیشتر