Connecting ESP32-Cam with SMTP Email Sending to Firebase RTDB #312
-
Hello, I am trying to connect my already functioning ESP32-Cam that can send a taken image via SMTP server. So far the Camera SMTP Code only works by itself, also the Firebase RTDB Code. But I want the camera to send a value to RTDB as well, and also get that value so I am trying to combine both. Is this possible? I am getting this error. I am using these libraries: **esp mail client version 3.4.15 Here is my code, i have removed my firebase, email, and wifi credentials. `#include "esp_camera.h" // REPLACE WITH YOUR NETWORK CREDENTIALS // Provide the token generation process info. // Provide the RTDB payload printing info and other helper functions. /* 2. Define the API Key */ /* 3. Define the RTDB URL */ /* 4. Define the user Email and password that alreadey registerd or added in your project */ // Define Firebase Data object FirebaseAuth auth; unsigned long count = 0; // To send Email using Gmail use port 465 (SSL) and SMTP Server smtp.gmail.com #define CAMERA_MODEL_AI_THINKER #if defined(CAMERA_MODEL_AI_THINKER) /* The SMTP Session object used for Email sending */ /* Callback function to get the Email sending status */ // Photo File Name to save in LittleFS void setup() { Serial.begin(115200); // Connect to Wi-Fi // Print ESP32 Local IP Address Serial.printf("Firebase Client v%s\n\n", FIREBASE_CLIENT_VERSION); /* Assign the api key (required) */ /* Assign the user sign in credentials */ /* Assign the RTDB URL (required) */ /* Assign the callback function for the long running token generation task */ // Comment or pass false value when WiFi reconnection will control by your code or third party library e.g. WiFiManager // Since v4.4.x, BearSSL engine was used, the SSL buffer need to be set. // Or use legacy authenticate method // To connect without auth in Test Mode, see Authentications/TestMode/TestMode.ino ////////////////////////////////////////////////////////////////////////////////////////////// Firebase.begin(&configF, &auth); Firebase.setDoubleDigits(5); // Init filesystem camera_config_t config; if(psramFound()){ // Initialize camera capturePhotoSaveLittleFS(); void loop() {
} // Capture Photo and Save it to LittleFS // Take a new photo // Photo file name // Insert the data in the photo file void sendPhoto( void ) { /** Enable the debug via Serial port
/* Set the callback function to get the sending results */ /* Declare the session config data */ /*Set the NTP config time /* Set the session config */ /* Declare the message class */ /* Enable the chunked data transfer with pipelining for large message if server supported */ /* Set the message headers */ message.subject = emailSubject; String htmlMsg = " Photo captured with ESP32-CAM and attached in this email.";message.html.content = htmlMsg.c_str(); message.html.charSet = "utf-8"; message.html.transfer_encoding = Content_Transfer_Encoding::enc_qp; message.priority = esp_mail_smtp_priority::esp_mail_smtp_priority_normal; /* The attachment data item */ /** Set the attachment info e.g.
/* Add attachment to the message */ /* Connect to server with the session config */ /* Start sending the Email and close the session */ // Callback function to get the Email sending status /* Print the sending result */
// You need to clear sending result as the memory usage will grow up. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 19 replies
-
You have to know and keep in mind when you wrote your code under Arduino platform that. YOU HAVE TO REMOVE ALL SD LIBRALIES IN ARDUINO LIBRARIES FOLDER THAT YOU INSTALLED BECAUSE IT CONFLICTS WITH THE SD LIBRARY OF CORE SDK. |
Beta Was this translation helpful? Give feedback.
-
The latest version v4.4.10 causes some error about lwIP which I will fix it soon. Please install the library version 4.4.8 instead. After installed version 4.4.8, in your sketch, please include #include <Arduino.h>
#include <WiFi.h>
#include <FirebaseESP32.h>
#include <ESP_Mail_Client.h> |
Beta Was this translation helpful? Give feedback.
The error is because global libraries installation issue in Arduino platform which can cause compilation error when many libraries contain the same built-in dependencies with different include paths.
This problem is never existed in other well managed IDE e.g.
PlatformIO
that all libraries are installed locally for portability.The workaround is you have to modify
ESP Mail Client
library bysrc/SSLClient
folder ofESP Mail Client
library.src/ESP_Mail_TCPClient.h
at line 60 from#include "SSLClient/ESP_SSLClient.h"
with#include "./client/SSLClient/ESP_SSLClient.h"