Skip to content

Commit 2a8d4b2

Browse files
committed
Add a define to force disable SSL #31
1 parent 6afd5ab commit 2a8d4b2

File tree

6 files changed

+42
-33
lines changed

6 files changed

+42
-33
lines changed

EMailSender.cpp

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* EMail Sender Arduino, esp8266, stm32 and esp32 library to send email
33
*
44
* AUTHOR: Renzo Mischianti
5-
* VERSION: 3.0.5
5+
* VERSION: 3.0.6
66
*
77
* https://www.mischianti.org/
88
*
@@ -468,33 +468,34 @@ EMailSender::Response EMailSender::send(const char* to[], byte sizeOfTo, byte s
468468

469469
DEBUG_PRINT(F("Insecure client:"));
470470
DEBUG_PRINTLN(this->isSecure);
471-
472-
#if (EMAIL_NETWORK_TYPE == NETWORK_ESP8266 || EMAIL_NETWORK_TYPE == NETWORK_ESP8266_242)
473-
#ifndef ARDUINO_ESP8266_RELEASE_2_4_2
474-
if (this->isSecure == false){
475-
client.setInsecure();
476-
bool mfln = client.probeMaxFragmentLength(this->smtp_server, this->smtp_port, 512);
477-
478-
DEBUG_PRINT("MFLN supported: ");
479-
DEBUG_PRINTLN(mfln?"yes":"no");
480-
481-
if (mfln) {
482-
client.setBufferSizes(512, 512);
471+
#ifndef FORCE_DISABLE_SSL
472+
#if (EMAIL_NETWORK_TYPE == NETWORK_ESP8266 || EMAIL_NETWORK_TYPE == NETWORK_ESP8266_242)
473+
#ifndef ARDUINO_ESP8266_RELEASE_2_4_2
474+
if (this->isSecure == false){
475+
client.setInsecure();
476+
bool mfln = client.probeMaxFragmentLength(this->smtp_server, this->smtp_port, 512);
477+
478+
DEBUG_PRINT("MFLN supported: ");
479+
DEBUG_PRINTLN(mfln?"yes":"no");
480+
481+
if (mfln) {
482+
client.setBufferSizes(512, 512);
483+
}
483484
}
484-
}
485-
#endif
486-
#elif (EMAIL_NETWORK_TYPE == NETWORK_ESP32)
487-
// String coreVersion = String(ESP.getSdkVersion());
488-
// uint8_t firstdot = coreVersion.indexOf('.');
489-
//
490-
// DEBUG_PRINTLN(coreVersion.substring(1, coreVersion.indexOf('.', firstdot+1)).toFloat());
491-
// DEBUG_PRINTLN(coreVersion.substring(1, coreVersion.indexOf('.', firstdot+1)).toFloat() >= 3.3f);
492-
// if (coreVersion.substring(1, coreVersion.indexOf('.', firstdot+1)).toFloat() >= 3.3f) {
493-
// client.setInsecure();
494-
// }
495-
#include <core_version.h>
496-
#if ((!defined(ARDUINO_ESP32_RELEASE_1_0_4)) && (!defined(ARDUINO_ESP32_RELEASE_1_0_3)) && (!defined(ARDUINO_ESP32_RELEASE_1_0_2)))
497-
client.setInsecure();
485+
#endif
486+
#elif (EMAIL_NETWORK_TYPE == NETWORK_ESP32)
487+
// String coreVersion = String(ESP.getSdkVersion());
488+
// uint8_t firstdot = coreVersion.indexOf('.');
489+
//
490+
// DEBUG_PRINTLN(coreVersion.substring(1, coreVersion.indexOf('.', firstdot+1)).toFloat());
491+
// DEBUG_PRINTLN(coreVersion.substring(1, coreVersion.indexOf('.', firstdot+1)).toFloat() >= 3.3f);
492+
// if (coreVersion.substring(1, coreVersion.indexOf('.', firstdot+1)).toFloat() >= 3.3f) {
493+
// client.setInsecure();
494+
// }
495+
#include <core_version.h>
496+
#if ((!defined(ARDUINO_ESP32_RELEASE_1_0_4)) && (!defined(ARDUINO_ESP32_RELEASE_1_0_3)) && (!defined(ARDUINO_ESP32_RELEASE_1_0_2)))
497+
client.setInsecure();
498+
#endif
498499
#endif
499500
#endif
500501
#endif

EMailSender.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* EMail Sender Arduino, esp8266, stm32 and esp32 library to send email
33
*
44
* AUTHOR: Renzo Mischianti
5-
* VERSION: 3.0.5
5+
* VERSION: 3.0.6
66
*
77
* https://www.mischianti.org/
88
*
@@ -213,7 +213,7 @@
213213
#elif(EMAIL_NETWORK_TYPE == NETWORK_WiFiNINA)
214214

215215
#include <WiFiNINA.h>
216-
//#define EMAIL_NETWORK_CLASS WiFiSSLClient
216+
#define EMAIL_NETWORK_CLASS WiFiClient
217217
#define EMAIL_NETWORK_SSL_CLASS WiFiSSLClient
218218
#define EMAIL_NETWORK_SERVER_CLASS WiFiServer
219219

@@ -298,7 +298,9 @@
298298
#endif
299299

300300
#ifdef EMAIL_NETWORK_SSL_CLASS
301-
#define EMAIL_NETWORK_CLASS EMAIL_NETWORK_SSL_CLASS
301+
#ifndef FORCE_DISABLE_SSL
302+
#define EMAIL_NETWORK_CLASS EMAIL_NETWORK_SSL_CLASS
303+
#endif
302304
#endif
303305

304306
#define OPEN_CLOSE_INTERNAL

EMailSenderKey.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* EMail Sender Arduino, esp8266, stm32 and esp32 library to send email
33
*
44
* AUTHOR: Renzo Mischianti
5-
* VERSION: 3.0.5
5+
* VERSION: 3.0.6
66
*
77
* https://www.mischianti.org/
88
*
@@ -37,6 +37,7 @@
3737
// Uncomment if you use esp8266 core <= 2.4.2
3838
//#define ARDUINO_ESP8266_RELEASE_2_4_2
3939

40+
// If you want disable attachments and save memory comment this define
4041
#define ENABLE_ATTACHMENTS
4142

4243
// Uncomment to enable printing out nice debug messages.
@@ -69,6 +70,10 @@
6970
#define NETWORK_UIPETHERNET (11)
7071
#define NETWORK_ETHERNET_2 (12)
7172

73+
// if you want force disable SSL if present uncomment this define
74+
// #define FORCE_DISABLE_SSL
75+
76+
// If you want add a wrapper to emulate SSL over Client like EthernetClient
7277
// #define SSLCLIENT_WRAPPER
7378

7479
// esp8266 microcontrollers configuration

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Arduino (support W5100 like must be set, and ENC28J60 via UIPEthernet), esp8266
2626
#### [Inviare email con allegati (libreria v2.x): esp32 e esp8266](https://www.mischianti.org/it/2020/06/16/inviare-email-con-allegati-libreria-v2-x-esp32-e-esp8266-part-2/)
2727

2828
## Change log
29+
- 16/08/2022: v3.0.6 Add FORCE_DISABLE_SSL to disable SSL if present
2930
- 19/07/2022: v3.0.5 Additional fix on additional response management ([#26](https://github.com/xreef/EMailSender/issues/26))
3031
- 12/07/2022: v3.0.4 Fixed attachment issue on SPIFFS and LittleFS
3132
- 06/07/2022: v3.0.3 Manage multiple response message after connect and HELO ([#26](https://github.com/xreef/EMailSender/issues/26))

library.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@
1616
},
1717
"url": "https://www.mischianti.org",
1818
"frameworks": "Arduino",
19-
"version": "3.0.5",
19+
"version": "3.0.6",
2020
"platforms": "*"
2121
}

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=EMailSender
2-
version=3.0.5
2+
version=3.0.6
33
author=Renzo Mischianti <[email protected]>
44
maintainer=Renzo Mischianti <[email protected]>
55
sentence=Send EMail via SMTP, library for Arduino, SAMD (WiFiNINA), STM32, esp8266 and esp32.

0 commit comments

Comments
 (0)