remove spiffs from sendmail lib

This commit is contained in:
gemu2015 2021-02-18 16:35:25 +01:00
parent dffdfafac1
commit c528bf20a9
8 changed files with 140 additions and 88 deletions

View File

@ -405,13 +405,14 @@ bool ESP_Mail_Client::readMail(IMAPSession *imap, bool closeSession)
if (!SD.exists(imap->_config->storage.saved_path)) if (!SD.exists(imap->_config->storage.saved_path))
createDirs(imap->_config->storage.saved_path); createDirs(imap->_config->storage.saved_path);
} }
else if (!_flashOk && imap->_storageType == esp_mail_file_storage_type_flash) else if (!_flashOk && imap->_storageType == esp_mail_file_storage_type_flash) {
#if defined(ESP32) #if defined(ESP32)
_flashOk = SPIFFS.begin(FORMAT_SPIFFS_IF_FAILED); // _flashOk = SPIFFS.begin(FORMAT_SPIFFS_IF_FAILED);
#elif defined(ESP8266) #elif defined(ESP8266)
_flashOk = FLASH_FS.begin(); // _flashOk = FLASH_FS.begin();
#endif #endif
} }
}
if (cHeader(imap)->part_headers.size() > 0) if (cHeader(imap)->part_headers.size() > 0)
{ {
@ -602,13 +603,13 @@ bool ESP_Mail_Client::readMail(IMAPSession *imap, bool closeSession)
} }
else if (imap->_storageType == esp_mail_file_storage_type_flash) else if (imap->_storageType == esp_mail_file_storage_type_flash)
{ {
if (_flashOk) if (_flashOk) {
#if defined(ESP32) #if defined(ESP32)
SPIFFS.end(); // SPIFFS.end();
#elif defined(ESP8266) #elif defined(ESP8266)
FLASH_FS.end(); // FLASH_FS.end();
#endif #endif
}
_flashOk = false; _flashOk = false;
} }
} }
@ -2752,13 +2753,13 @@ bool ESP_Mail_Client::sendAttachments(SMTPSession *smtp, SMTP_Message *msg, cons
if (!_sdOk && att->file.storage_type == esp_mail_file_storage_type_sd) if (!_sdOk && att->file.storage_type == esp_mail_file_storage_type_sd)
_sdOk = sdTest(); _sdOk = sdTest();
if (!_flashOk && att->file.storage_type == esp_mail_file_storage_type_flash) if (!_flashOk && att->file.storage_type == esp_mail_file_storage_type_flash) {
#if defined(ESP32) #if defined(ESP32)
_flashOk = SPIFFS.begin(FORMAT_SPIFFS_IF_FAILED); // _flashOk = SPIFFS.begin(FORMAT_SPIFFS_IF_FAILED);
#elif defined(ESP8266) #elif defined(ESP8266)
_flashOk = FLASH_FS.begin(); // _flashOk = FLASH_FS.begin();
#endif #endif
}
if ((!_sdOk && att->file.storage_type == esp_mail_file_storage_type_sd) || (!_flashOk && att->file.storage_type == esp_mail_file_storage_type_flash)) if ((!_sdOk && att->file.storage_type == esp_mail_file_storage_type_sd) || (!_flashOk && att->file.storage_type == esp_mail_file_storage_type_flash))
{ {
@ -2815,9 +2816,9 @@ bool ESP_Mail_Client::openFileRead(SMTPSession *smtp, SMTP_Message *msg, SMTP_At
} }
else if (att->file.storage_type == esp_mail_file_storage_type_flash) { else if (att->file.storage_type == esp_mail_file_storage_type_flash) {
#if defined(ESP32) #if defined(ESP32)
file_existed = SPIFFS.exists(filepath.c_str()); //file_existed = SPIFFS.exists(filepath.c_str());
#elif defined(ESP8266) #elif defined(ESP8266)
file_existed = FLASH_FS.exists(filepath.c_str()); //file_existed = FLASH_FS.exists(filepath.c_str());
#endif #endif
} else if (att->file.storage_type == esp_mail_file_storage_type_univ) { } else if (att->file.storage_type == esp_mail_file_storage_type_univ) {
file_existed = ufsp->exists(filepath.c_str()); file_existed = ufsp->exists(filepath.c_str());
@ -2838,9 +2839,9 @@ bool ESP_Mail_Client::openFileRead(SMTPSession *smtp, SMTP_Message *msg, SMTP_At
} }
else if (att->file.storage_type == esp_mail_file_storage_type_flash) { else if (att->file.storage_type == esp_mail_file_storage_type_flash) {
#if defined(ESP32) #if defined(ESP32)
file_existed = SPIFFS.exists(filepath.c_str()); //file_existed = SPIFFS.exists(filepath.c_str());
#elif defined(ESP8266) #elif defined(ESP8266)
file_existed = FLASH_FS.exists(filepath.c_str()); //file_existed = FLASH_FS.exists(filepath.c_str());
#endif #endif
} }
else if (att->file.storage_type == esp_mail_file_storage_type_univ) { else if (att->file.storage_type == esp_mail_file_storage_type_univ) {
@ -2882,9 +2883,9 @@ bool ESP_Mail_Client::openFileRead(SMTPSession *smtp, SMTP_Message *msg, SMTP_At
} }
else if (att->file.storage_type == esp_mail_file_storage_type_flash) { else if (att->file.storage_type == esp_mail_file_storage_type_flash) {
#if defined(ESP32) #if defined(ESP32)
file = SPIFFS.open(filepath.c_str(), FILE_READ); //file = SPIFFS.open(filepath.c_str(), FILE_READ);
#elif defined(ESP8266) #elif defined(ESP8266)
file = FLASH_FS.open(filepath.c_str(), "r"); //file = FLASH_FS.open(filepath.c_str(), "r");
#endif #endif
} }
else if (att->file.storage_type == esp_mail_file_storage_type_univ) { else if (att->file.storage_type == esp_mail_file_storage_type_univ) {
@ -2997,13 +2998,13 @@ bool ESP_Mail_Client::sendInline(SMTPSession *smtp, SMTP_Message *msg, const std
if (!_sdOk && att->file.storage_type == esp_mail_file_storage_type_sd) if (!_sdOk && att->file.storage_type == esp_mail_file_storage_type_sd)
_sdOk = sdTest(); _sdOk = sdTest();
if (!_flashOk && att->file.storage_type == esp_mail_file_storage_type_flash) if (!_flashOk && att->file.storage_type == esp_mail_file_storage_type_flash) {
#if defined(ESP32) #if defined(ESP32)
_flashOk = SPIFFS.begin(FORMAT_SPIFFS_IF_FAILED); // _flashOk = SPIFFS.begin(FORMAT_SPIFFS_IF_FAILED);
#elif defined(ESP8266) #elif defined(ESP8266)
_flashOk = FLASH_FS.begin(); // _flashOk = FLASH_FS.begin();
#endif #endif
}
if ((!_sdOk && att->file.storage_type == esp_mail_file_storage_type_sd) || (!_flashOk && att->file.storage_type == esp_mail_file_storage_type_flash)) if ((!_sdOk && att->file.storage_type == esp_mail_file_storage_type_sd) || (!_flashOk && att->file.storage_type == esp_mail_file_storage_type_flash))
{ {
@ -5694,13 +5695,13 @@ void ESP_Mail_Client::saveHeader(IMAPSession *imap)
prepareFilePath(imap, headerFilePath, true); prepareFilePath(imap, headerFilePath, true);
if (imap->_storageType == esp_mail_file_storage_type_sd && !_sdOk) if (imap->_storageType == esp_mail_file_storage_type_sd && !_sdOk)
_sdOk = sdTest(); _sdOk = sdTest();
else if (imap->_storageType == esp_mail_file_storage_type_flash && !_flashOk) else if (imap->_storageType == esp_mail_file_storage_type_flash && !_flashOk) {
#if defined(ESP32) #if defined(ESP32)
_flashOk = SPIFFS.begin(FORMAT_SPIFFS_IF_FAILED); // _flashOk = SPIFFS.begin(FORMAT_SPIFFS_IF_FAILED);
#elif defined(ESP8266) #elif defined(ESP8266)
_flashOk = FLASH_FS.begin(); // _flashOk = FLASH_FS.begin();
#endif #endif
}
if (_sdOk || _flashOk) if (_sdOk || _flashOk)
{ {
if (file) if (file)
@ -5708,13 +5709,13 @@ void ESP_Mail_Client::saveHeader(IMAPSession *imap)
if (imap->_storageType == esp_mail_file_storage_type_sd) if (imap->_storageType == esp_mail_file_storage_type_sd)
file = SD.open(headerFilePath.c_str(), FILE_WRITE); file = SD.open(headerFilePath.c_str(), FILE_WRITE);
else if (imap->_storageType == esp_mail_file_storage_type_flash) else if (imap->_storageType == esp_mail_file_storage_type_flash) {
#if defined(ESP32) #if defined(ESP32)
file = SPIFFS.open(headerFilePath.c_str(), FILE_WRITE); // file = SPIFFS.open(headerFilePath.c_str(), FILE_WRITE);
#elif defined(ESP8266) #elif defined(ESP8266)
file = FLASH_FS.open(headerFilePath.c_str(), "w"); // file = FLASH_FS.open(headerFilePath.c_str(), "w");
#endif #endif
}
if (file) if (file)
{ {
std::string s; std::string s;
@ -5932,13 +5933,13 @@ bool ESP_Mail_Client::handleAttachment(IMAPSession *imap, char *buf, int bufLen,
if (imap->_storageType == esp_mail_file_storage_type_sd && !_sdOk) if (imap->_storageType == esp_mail_file_storage_type_sd && !_sdOk)
_sdOk = sdTest(); _sdOk = sdTest();
else if (imap->_storageType == esp_mail_file_storage_type_flash && !_flashOk) else if (imap->_storageType == esp_mail_file_storage_type_flash && !_flashOk) {
#if defined(ESP32) #if defined(ESP32)
_flashOk = SPIFFS.begin(FORMAT_SPIFFS_IF_FAILED); // _flashOk = SPIFFS.begin(FORMAT_SPIFFS_IF_FAILED);
#elif defined(ESP8266) #elif defined(ESP8266)
_flashOk = FLASH_FS.begin(); // _flashOk = FLASH_FS.begin();
#endif #endif
}
if (_sdOk || _flashOk) if (_sdOk || _flashOk)
{ {
@ -5962,14 +5963,15 @@ bool ESP_Mail_Client::handleAttachment(IMAPSession *imap, char *buf, int bufLen,
if (imap->_storageType == esp_mail_file_storage_type_sd) if (imap->_storageType == esp_mail_file_storage_type_sd)
file = SD.open(filePath.c_str(), FILE_WRITE); file = SD.open(filePath.c_str(), FILE_WRITE);
else if (imap->_storageType == esp_mail_file_storage_type_flash) else if (imap->_storageType == esp_mail_file_storage_type_flash) {
#if defined(ESP32) #if defined(ESP32)
file = SPIFFS.open(filePath.c_str(), FILE_WRITE); // file = SPIFFS.open(filePath.c_str(), FILE_WRITE);
#elif defined(ESP8266) #elif defined(ESP8266)
file = FLASH_FS.open(filePath.c_str(), "w"); // file = FLASH_FS.open(filePath.c_str(), "w");
#endif #endif
} }
} }
}
if (_sdOk || _flashOk) if (_sdOk || _flashOk)
{ {
@ -6362,14 +6364,15 @@ void ESP_Mail_Client::decodeText(IMAPSession *imap, char *buf, int bufLen, int &
if (imap->_storageType == esp_mail_file_storage_type_sd) if (imap->_storageType == esp_mail_file_storage_type_sd)
file = SD.open(filePath.c_str(), FILE_WRITE); file = SD.open(filePath.c_str(), FILE_WRITE);
else if (imap->_storageType == esp_mail_file_storage_type_flash) else if (imap->_storageType == esp_mail_file_storage_type_flash) {
#if defined(ESP32) #if defined(ESP32)
file = SPIFFS.open(filePath.c_str(), FILE_WRITE); // file = SPIFFS.open(filePath.c_str(), FILE_WRITE);
#elif defined(ESP8266) #elif defined(ESP8266)
file = FLASH_FS.open(filePath.c_str(), "w"); // file = FLASH_FS.open(filePath.c_str(), "w");
#endif #endif
} }
} }
}
if (_sdOk || _flashOk) if (_sdOk || _flashOk)
file.write((const uint8_t *)decoded, olen); file.write((const uint8_t *)decoded, olen);
@ -7294,13 +7297,14 @@ bool IMAPSession::connect(ESP_Mail_Session *sesssion, IMAP_Config *config)
{ {
if (_sesson_cfg->certificate.cert_file_storage_type == esp_mail_file_storage_type::esp_mail_file_storage_type_sd && !MailClient._sdOk) if (_sesson_cfg->certificate.cert_file_storage_type == esp_mail_file_storage_type::esp_mail_file_storage_type_sd && !MailClient._sdOk)
MailClient._sdOk = MailClient.sdTest(); MailClient._sdOk = MailClient.sdTest();
if (_sesson_cfg->certificate.cert_file_storage_type == esp_mail_file_storage_type::esp_mail_file_storage_type_flash && !MailClient._flashOk) if (_sesson_cfg->certificate.cert_file_storage_type == esp_mail_file_storage_type::esp_mail_file_storage_type_flash && !MailClient._flashOk) {
#if defined(ESP32) #if defined(ESP32)
MailClient._flashOk = SPIFFS.begin(FORMAT_SPIFFS_IF_FAILED); // MailClient._flashOk = SPIFFS.begin(FORMAT_SPIFFS_IF_FAILED);
#elif defined(ESP8266) #elif defined(ESP8266)
MailClient._flashOk = FLASH_FS.begin(); // MailClient._flashOk = FLASH_FS.begin();
#endif #endif
} }
}
return MailClient.imapAuth(this); return MailClient.imapAuth(this);
} }
@ -7978,12 +7982,14 @@ bool SMTPSession::connect(ESP_Mail_Session *config)
{ {
if (_sesson_cfg->certificate.cert_file_storage_type == esp_mail_file_storage_type::esp_mail_file_storage_type_sd && !MailClient._sdOk) if (_sesson_cfg->certificate.cert_file_storage_type == esp_mail_file_storage_type::esp_mail_file_storage_type_sd && !MailClient._sdOk)
MailClient._sdOk = MailClient.sdTest(); MailClient._sdOk = MailClient.sdTest();
if (_sesson_cfg->certificate.cert_file_storage_type == esp_mail_file_storage_type::esp_mail_file_storage_type_flash && !MailClient._flashOk) if (_sesson_cfg->certificate.cert_file_storage_type == esp_mail_file_storage_type::esp_mail_file_storage_type_flash && !MailClient._flashOk) {
#if defined(ESP32) #if defined(ESP32)
MailClient._flashOk = SPIFFS.begin(FORMAT_SPIFFS_IF_FAILED); // MailClient._flashOk = SPIFFS.begin(FORMAT_SPIFFS_IF_FAILED);
#elif defined(ESP8266) #elif defined(ESP8266)
MailClient._flashOk = FLASH_FS.begin(); // MailClient._flashOk = FLASH_FS.begin();
#endif #endif
MailClient._flashOk = 1;
}
} }
return MailClient.smtpAuth(this); return MailClient.smtpAuth(this);
} }

View File

@ -48,7 +48,7 @@
#include <HTTPClient.h> #include <HTTPClient.h>
#include <WiFiClientSecure.h> #include <WiFiClientSecure.h>
#include <FS.h> #include <FS.h>
#include <SPIFFS.h> //#include <SPIFFS.h>
#include <ETH.h> #include <ETH.h>
#include "wcs/esp32/ESP_Mail_HTTPClient32.h" #include "wcs/esp32/ESP_Mail_HTTPClient32.h"
#include "extras/ESPTimeHelper.h" #include "extras/ESPTimeHelper.h"

View File

@ -205,8 +205,9 @@ void ESP_Mail_HTTPClient32::setCertFile(const char *caCertFile, esp_mail_file_st
bool t = false; bool t = false;
_certType = 2; _certType = 2;
if (storageType == esp_mail_file_storage_type::esp_mail_file_storage_type_flash) if (storageType == esp_mail_file_storage_type::esp_mail_file_storage_type_flash) {
t = SPIFFS.begin(true); // t = SPIFFS.begin(true);
}
else if (storageType == esp_mail_file_storage_type::esp_mail_file_storage_type_sd) else if (storageType == esp_mail_file_storage_type::esp_mail_file_storage_type_sd)
t = SD.begin(); t = SD.begin();
if (!t) if (!t)
@ -215,8 +216,8 @@ void ESP_Mail_HTTPClient32::setCertFile(const char *caCertFile, esp_mail_file_st
File f; File f;
if (storageType == esp_mail_file_storage_type::esp_mail_file_storage_type_flash) if (storageType == esp_mail_file_storage_type::esp_mail_file_storage_type_flash)
{ {
if (SPIFFS.exists(caCertFile)) //if (SPIFFS.exists(caCertFile))
f = SPIFFS.open(caCertFile, FILE_READ); // f = SPIFFS.open(caCertFile, FILE_READ);
} }
else if (storageType == esp_mail_file_storage_type::esp_mail_file_storage_type_sd) else if (storageType == esp_mail_file_storage_type::esp_mail_file_storage_type_sd)
{ {

View File

@ -37,7 +37,7 @@
#include <Arduino.h> #include <Arduino.h>
#include <WiFiClient.h> #include <WiFiClient.h>
#include <FS.h> #include <FS.h>
#include <SPIFFS.h> //#include <SPIFFS.h>
#include <SD.h> #include <SD.h>
#include "ESP_Mail_WCS32.h" #include "ESP_Mail_WCS32.h"

View File

@ -53,6 +53,9 @@ extern "C"
#include <c_types.h> #include <c_types.h>
#include <coredecls.h> #include <coredecls.h>
//#define Optimistic_yield(A) optimistic_yield(A);ESP.wdtFeed();
#define Optimistic_yield(A) optimistic_yield(A)
#if !CORE_MOCK #if !CORE_MOCK
// The BearSSL thunks in use for now // The BearSSL thunks in use for now
@ -315,7 +318,7 @@ namespace ESP_Mail
// Ensure we yield if we need multiple fragments to avoid WDT // Ensure we yield if we need multiple fragments to avoid WDT
if (sent_bytes) if (sent_bytes)
{ {
optimistic_yield(1000); Optimistic_yield(1000);
} }
// Get BearSSL to a state where we can send // Get BearSSL to a state where we can send
@ -519,7 +522,7 @@ namespace ESP_Mail
for (int no_work = 0; blocking || no_work < 2;) for (int no_work = 0; blocking || no_work < 2;)
{ {
optimistic_yield(100); Optimistic_yield(100);
if (loopTimeout) if (loopTimeout)
{ {
@ -662,7 +665,7 @@ namespace ESP_Mail
{ {
_handshake_done = true; _handshake_done = true;
} }
optimistic_yield(1000); Optimistic_yield(1000);
} }
return _handshake_done; return _handshake_done;
} }
@ -2047,7 +2050,7 @@ namespace ESP_Mail
if (!result) if (!result)
{ {
optimistic_yield(100); Optimistic_yield(100);
} }
return result; return result;
} }

View File

@ -1,11 +1,20 @@
#ifdef USE_ESP32MAIL #ifdef USE_ESP32MAIL
#include <ESP_Mail_Client.h> #include <ESP_Mail_Client.h>
#ifdef ESP8266
#ifndef SEND_MAIL32_MINRAM
#define SEND_MAIL32_MINRAM 13*1024
#endif
#endif // ESP8266
#ifdef ESP32
#ifndef SEND_MAIL32_MINRAM #ifndef SEND_MAIL32_MINRAM
#define SEND_MAIL32_MINRAM 30*1024 #define SEND_MAIL32_MINRAM 30*1024
#endif #endif
#endif // ESP32
#define xPSTR(a) a #define xPSTR(a) a
#define MAX_ATTCHMENTS 8 #define MAX_ATTCHMENTS 8
char *attachments[MAX_ATTCHMENTS]; char *attachments[MAX_ATTCHMENTS];
@ -13,6 +22,8 @@ uint8_t num_attachments;
void script_send_email_body(void(*func)(char *)); void script_send_email_body(void(*func)(char *));
String html_content = ""; String html_content = "";
SMTP_Message *email_mptr; SMTP_Message *email_mptr;
SMTPSession smtp;
void smtpCallback(SMTP_Status status);
//#define DEBUG_EMAIL_PORT //#define DEBUG_EMAIL_PORT
@ -30,7 +41,6 @@ uint16_t SendMail(char *buffer) {
uint16_t status = 0; uint16_t status = 0;
uint16_t blen; uint16_t blen;
char *endcmd; char *endcmd;
SMTPSession smtp;
ESP_Mail_Session session; ESP_Mail_Session session;
SMTP_Message message; SMTP_Message message;
email_mptr = &message; email_mptr = &message;
@ -39,8 +49,11 @@ uint16_t SendMail(char *buffer) {
uint32_t mem = ESP.getFreeHeap(); uint32_t mem = ESP.getFreeHeap();
//AddLog(LOG_LEVEL_INFO, PSTR("heap: %d"),mem); //AddLog(LOG_LEVEL_INFO, PSTR("heap: %d"),mem);
if (mem < SEND_MAIL32_MINRAM) { if (mem < SEND_MAIL32_MINRAM) {
// return 4; return 4;
} }
#ifdef DEBUG_EMAIL_PORT
AddLog(LOG_LEVEL_INFO, PSTR("heap: %d"),mem);
#endif
while (*buffer==' ') buffer++; while (*buffer==' ') buffer++;
@ -156,13 +169,12 @@ uint16_t SendMail(char *buffer) {
//smtp.debug(true); //smtp.debug(true);
smtp.debug(false); smtp.debug(false);
// smtp.callback(smtpCallback);
message.clearRecipients(); message.clearRecipients();
message.clearCc(); message.clearCc();
message.clearBcc(); message.clearBcc();
//smtp.callback(smtpCallback);
session.server.host_name = mserv; session.server.host_name = mserv;
session.server.port = port; session.server.port = port;
session.login.email = user; session.login.email = user;
@ -322,4 +334,35 @@ void attach_Data(char *name, uint8_t *buff, uint32_t len) {
email_mptr->resetAttachItem(att); email_mptr->resetAttachItem(att);
} }
/* Callback function to get the Email sending status */
void smtpCallback(SMTP_Status status)
{
/* Print the current status */
Serial.println(status.info());
/* Print the sending result */
if (status.success())
{
Serial.println("----------------");
Serial.printf("Message sent success: %d\n", status.completedCount());
Serial.printf("Message sent failled: %d\n", status.failedCount());
Serial.println("----------------\n");
struct tm dt;
for (size_t i = 0; i < smtp.sendingResult.size(); i++)
{
/* Get the result item */
SMTP_Result result = smtp.sendingResult.getItem(i);
localtime_r(&result.timesstamp, &dt);
Serial.printf("Message No: %d\n", i + 1);
Serial.printf("Status: %s\n", result.completed ? "success" : "failed");
Serial.printf("Date/Time: %d/%d/%d %d:%d:%d\n", dt.tm_year + 1900, dt.tm_mon + 1, dt.tm_mday, dt.tm_hour, dt.tm_min, dt.tm_sec);
Serial.printf("Recipient: %s\n", result.recipients);
Serial.printf("Subject: %s\n", result.subject);
}
Serial.println("----------------\n");
}
}
#endif // USE_ESP32MAIL #endif // USE_ESP32MAIL

View File

@ -2924,7 +2924,7 @@ const char kWebCommands[] PROGMEM = "|" // No prefix
#ifdef USE_EMULATION #ifdef USE_EMULATION
D_CMND_EMULATION "|" D_CMND_EMULATION "|"
#endif #endif
#ifdef USE_SENDMAIL #if defined(USE_SENDMAIL) || defined(USE_ESP32MAIL)
D_CMND_SENDMAIL "|" D_CMND_SENDMAIL "|"
#endif #endif
D_CMND_WEBSERVER "|" D_CMND_WEBPASSWORD "|" D_CMND_WEBLOG "|" D_CMND_WEBREFRESH "|" D_CMND_WEBSEND "|" D_CMND_WEBCOLOR "|" D_CMND_WEBSERVER "|" D_CMND_WEBPASSWORD "|" D_CMND_WEBLOG "|" D_CMND_WEBREFRESH "|" D_CMND_WEBSEND "|" D_CMND_WEBCOLOR "|"
@ -2934,7 +2934,7 @@ void (* const WebCommand[])(void) PROGMEM = {
#ifdef USE_EMULATION #ifdef USE_EMULATION
&CmndEmulation, &CmndEmulation,
#endif #endif
#ifdef USE_SENDMAIL #if defined(USE_SENDMAIL) || defined(USE_ESP32MAIL)
&CmndSendmail, &CmndSendmail,
#endif #endif
&CmndWebServer, &CmndWebPassword, &CmndWeblog, &CmndWebRefresh, &CmndWebSend, &CmndWebColor, &CmndWebServer, &CmndWebPassword, &CmndWeblog, &CmndWebRefresh, &CmndWebSend, &CmndWebColor,
@ -2966,7 +2966,7 @@ void CmndEmulation(void)
} }
#endif // USE_EMULATION #endif // USE_EMULATION
#ifdef USE_SENDMAIL #if defined(USE_SENDMAIL) || defined(USE_ESP32MAIL)
void CmndSendmail(void) void CmndSendmail(void)
{ {
if (XdrvMailbox.data_len > 0) { if (XdrvMailbox.data_len > 0) {

View File

@ -4325,7 +4325,7 @@ int16_t Run_script_sub(const char *type, int8_t tlen, struct GVARS *gv) {
ResponseAppend_P(PSTR("%s"), tmp); ResponseAppend_P(PSTR("%s"), tmp);
goto next_line; goto next_line;
} }
#ifdef USE_SENDMAIL #if defined(USE_SENDMAIL) || defined(USE_ESP32MAIL)
else if (!strncmp(lp, "mail", 4)) { else if (!strncmp(lp, "mail", 4)) {
lp+=5; lp+=5;
char tmp[256]; char tmp[256];
@ -4680,10 +4680,9 @@ int16_t Run_script_sub(const char *type, int8_t tlen, struct GVARS *gv) {
uint8_t script_xsns_index = 0; uint8_t script_xsns_index = 0;
void ScripterEvery100ms(void) { void ScripterEvery100ms(void) {
if (Settings.rule_enabled && (TasmotaGlobal.uptime > 4)) { if (bitRead(Settings.rule_enabled, 0) && (TasmotaGlobal.uptime > 4)) {
ResponseClear(); ResponseClear();
uint16_t script_tele_period_save = TasmotaGlobal.tele_period; uint16_t script_tele_period_save = TasmotaGlobal.tele_period;
TasmotaGlobal.tele_period = 2; TasmotaGlobal.tele_period = 2;
@ -4695,7 +4694,7 @@ void ScripterEvery100ms(void) {
Run_Scripter(">T", 2, TasmotaGlobal.mqtt_data); Run_Scripter(">T", 2, TasmotaGlobal.mqtt_data);
} }
} }
if (Settings.rule_enabled) { if (bitRead(Settings.rule_enabled, 0)) {
if (glob_script_mem.fast_script == 99) Run_Scripter(">F", 2, 0); if (glob_script_mem.fast_script == 99) Run_Scripter(">F", 2, 0);
} }
} }
@ -7161,7 +7160,7 @@ nextwebline:
#endif //USE_SCRIPT_WEB_DISPLAY #endif //USE_SCRIPT_WEB_DISPLAY
#ifdef USE_SENDMAIL #if defined(USE_SENDMAIL) || defined(USE_ESP32MAIL)
void script_send_email_body(void(*func)(char *)) { void script_send_email_body(void(*func)(char *)) {
uint8_t msect = Run_Scripter(">m", -2, 0); uint8_t msect = Run_Scripter(">m", -2, 0);