Closed ba58smith closed 11 months ago
Hi @ba58smith, I know that when I have some time, I will fix It in the future, but not soon. Thanks Renzo
Renzo,
Everywhere EMAIL_NETWORK_SSL_CLASS
is defined, EMAIL_NETWORK_CLASS
is also defined, like below, for NETWORK_ESP32
:
#elif(EMAIL_NETWORK_TYPE == NETWORK_ESP32)
#include <WiFi.h>
#include <WiFiClientSecure.h>
#define EMAIL_NETWORK_CLASS WiFiClient
#define EMAIL_NETWORK_SSL_CLASS WiFiClientSecure
#define EMAIL_NETWORK_SERVER_CLASS WiFiServer
If I change every one of those to something like this...
#elif(EMAIL_NETWORK_TYPE == NETWORK_ESP32)
#include <WiFi.h>
#include <WiFiClientSecure.h>
#ifndef FORCE_DISABLE_SSL
#define EMAIL_NETWORK_CLASS WiFiClientSecure
#else
#define EMAIL_NETWORK_CLASS WiFiClient
#endif
#define EMAIL_NETWORK_SSL_CLASS WiFiClientSecure
#define EMAIL_NETWORK_SERVER_CLASS WiFiServer
...then I think I can remove the redefinition of EMAIL_NETWORK_CLASS
(lines 304 to 308, below):
#ifdef EMAIL_NETWORK_SSL_CLASS
#ifndef FORCE_DISABLE_SSL
#define EMAIL_NETWORK_CLASS EMAIL_NETWORK_SSL_CLASS
#endif
#endif
There may be a more elegant way of solving the issue, but I'm not seeing it. If you like my suggestion, I'll make a PR for it - however, I have no way to test it with all of the different types of processors.
Just to add I have the same problem, compiling with arduino 1.8.19 for an esp8266:
/home/andy/Arduino/libraries/EMailSender-master/EMailSender.h:222: warning: EMAIL_NETWORK_CLASS" redefined
222 | #define EMAIL_NETWORK_CLASS EMAIL_NETWORK_SSL_CLASS
|
In file included from /home/andy/Arduino/oilsensor7/email.cpp:16:
/home/andy/Arduino/libraries/EMailSender-master/EMailSender.h:131: note: this is the location of the previous definition
131 | #define EMAIL_NETWORK_CLASS WiFiClient
The upper solution (Andy2051) works for me. I updated the [...]/libraries/EMailSender/EMailSender.h according to what Andy2051 wrote.
libraries/EMailSender/EMailSender.h file lines 189 to 200 go like this:
#elif(EMAIL_NETWORK_TYPE == NETWORK_ESP32)
#include <WiFi.h>
#include <WiFiClientSecure.h>
#ifndef FORCE_DISABLE_SSL
#define EMAIL_NETWORK_CLASS WiFiClientSecure
#else
#define EMAIL_NETWORK_CLASS WiFiClient
#endif
#define EMAIL_NETWORK_SSL_CLASS WiFiClientSecure
#define EMAIL_NETWORK_SERVER_CLASS WiFiServer
and lines 326 to 332 :
#ifdef EMAIL_NETWORK_SSL_CLASS
#ifndef FORCE_DISABLE_SSL
#define EMAIL_NETWORK_CLASS WiFiClientSecure
#else
#define EMAIL_NETWORK_CLASS WiFiClient
#endif
#endif
Thanks to all, I create a new release soon.
Using PlatformIO and VS Code, compiling for ESP32 (board = lolin32), I always get:
And if I look at EMailSender.h, I see that both lines 182 and 302 are trying to define EMAIL_NETWORK_CLASS. That is, the compiler has both of those lines displayed in normal (not grayed-out) text.
This is only a WARNING, so my code still compiles, but it's always nice to not have any warnings, especially if it's an easy fix.