diff --git a/README.md b/README.md index aa9d1b33..b14ca54c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Mail Client Arduino Library v1.5.1 +# Mail Client Arduino Library v1.5.2 [![Join the chat at https://gitter.im/mobizt/ESP_Mail_Client](https://badges.gitter.im/mobizt/ESP_Mail_Client.svg)](https://gitter.im/mobizt/ESP_Mail_Client?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) diff --git a/library.json b/library.json index 2c4b9cc3..9d27f0b5 100644 --- a/library.json +++ b/library.json @@ -1,6 +1,6 @@ { "name": "ESP Mail Client", - "version": "1.5.1", + "version": "1.5.2", "keywords": "communication, email, imap, smtp, esp32, esp8266, samd, arduino", "description": "E-Mail Client Arduino Library that supports Espressif ESP32, ESP8266 and SAMD21 devices with built-in U-blox NINA-W102 module. This allows embedded devices to send, read Email, and get mailbox changes notification. The various types of content and attacment are supported. The library also supports Ethernet connection (ESP8266 and ESP32) through secure (SSL) and non-secure ports.", "repository": { diff --git a/library.properties b/library.properties index 944f500d..3784807b 100644 --- a/library.properties +++ b/library.properties @@ -1,6 +1,6 @@ name=ESP Mail Client -version=1.5.1 +version=1.5.2 author=Mobizt diff --git a/src/ESP_Mail_Client.cpp b/src/ESP_Mail_Client.cpp index 1df20e7e..fc15af16 100644 --- a/src/ESP_Mail_Client.cpp +++ b/src/ESP_Mail_Client.cpp @@ -1,12 +1,11 @@ /** * Mail Client Arduino Library for Espressif's ESP32 and ESP8266 and SAMD21 with u-blox NINA-W102 WiFi/Bluetooth module * - * Version: 1.5.1 + * Version: 1.5.2 * Released: September 14, 2021 * * Updates: - * - Fix the IMAP issue #94, undetected attachments and unable to download since v1.3.3 to v1.5.0. - * - Defer the IMAP polling error report. + * - Fix the IMAP issue #94, unable to save file to SD media since v1.3.3 to v1.5.1. * * * This library allows Espressif's ESP32, ESP8266 and SAMD devices to send and read Email through the SMTP and IMAP servers. @@ -396,14 +395,14 @@ bool ESP_Mail_Client::readMail(IMAPSession *imap, bool closeSession) if (imap->_config->download.text || imap->_config->download.html || imap->_config->download.attachment || imap->_config->download.inlineImg) { - if (!_sdOk && imap->_storageType == esp_mail_file_storage_type_sd) + if (!_sdOk && imap->_config->storage.type == esp_mail_file_storage_type_sd) { _sdOk = sdTest(); if (_sdOk) if (!ESP_MAIL_SD_FS.exists(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->_config->storage.type == esp_mail_file_storage_type_flash) #if defined(ESP32) _flashOk = ESP_MAIL_FLASH_FS.begin(FORMAT_FLASH); #elif defined(ESP8266) @@ -595,7 +594,7 @@ bool ESP_Mail_Client::readMail(IMAPSession *imap, bool closeSession) if (closeSession) { - if (imap->_storageType == esp_mail_file_storage_type_sd) + if (imap->_config->storage.type == esp_mail_file_storage_type_sd) { #if defined(ESP_MAIL_SD_FS) if (_sdOk) @@ -603,7 +602,7 @@ bool ESP_Mail_Client::readMail(IMAPSession *imap, bool closeSession) #endif _sdOk = false; } - else if (imap->_storageType == esp_mail_file_storage_type_flash) + else if (imap->_config->storage.type == esp_mail_file_storage_type_flash) { #if defined(ESP_MAIL_FLASH_FS) @@ -6051,9 +6050,9 @@ void ESP_Mail_Client::saveHeader(IMAPSession *imap) std::string headerFilePath; prepareFilePath(imap, headerFilePath, true); - if (imap->_storageType == esp_mail_file_storage_type_sd && !_sdOk) + if (imap->_config->storage.type == esp_mail_file_storage_type_sd && !_sdOk) _sdOk = sdTest(); - else if (imap->_storageType == esp_mail_file_storage_type_flash && !_flashOk) + else if (imap->_config->storage.type == esp_mail_file_storage_type_flash && !_flashOk) #if defined(ESP32) _flashOk = ESP_MAIL_FLASH_FS.begin(FORMAT_FLASH); #elif defined(ESP8266) @@ -6065,9 +6064,9 @@ void ESP_Mail_Client::saveHeader(IMAPSession *imap) if (file) file.close(); - if (imap->_storageType == esp_mail_file_storage_type_sd) + if (imap->_config->storage.type == esp_mail_file_storage_type_sd) file = ESP_MAIL_SD_FS.open(headerFilePath.c_str(), FILE_WRITE); - else if (imap->_storageType == esp_mail_file_storage_type_flash) + else if (imap->_config->storage.type == esp_mail_file_storage_type_flash) #if defined(ESP32) file = ESP_MAIL_FLASH_FS.open(headerFilePath.c_str(), FILE_WRITE); #elif defined(ESP8266) @@ -6289,9 +6288,9 @@ bool ESP_Mail_Client::handleAttachment(IMAPSession *imap, char *buf, int bufLen, cPart(imap)->file_open_write = true; - if (imap->_storageType == esp_mail_file_storage_type_sd && !_sdOk) + if (imap->_config->storage.type == esp_mail_file_storage_type_sd && !_sdOk) _sdOk = sdTest(); - else if (imap->_storageType == esp_mail_file_storage_type_flash && !_flashOk) + else if (imap->_config->storage.type == esp_mail_file_storage_type_flash && !_flashOk) #if defined(ESP32) _flashOk = ESP_MAIL_FLASH_FS.begin(FORMAT_FLASH); #elif defined(ESP8266) @@ -6312,7 +6311,7 @@ bool ESP_Mail_Client::handleAttachment(IMAPSession *imap, char *buf, int bufLen, delS(tmp); #if defined(ESP_MAIL_SD_FS) - if (imap->_storageType == esp_mail_file_storage_type_sd) + if (imap->_config->storage.type == esp_mail_file_storage_type_sd) if (!ESP_MAIL_SD_FS.exists(filePath.c_str())) createDirs(filePath); #endif @@ -6321,11 +6320,11 @@ bool ESP_Mail_Client::handleAttachment(IMAPSession *imap, char *buf, int bufLen, filePath += cPart(imap)->filename; - if (imap->_storageType == esp_mail_file_storage_type_sd) + if (imap->_config->storage.type == esp_mail_file_storage_type_sd) #if defined(ESP_MAIL_SD_FS) file = ESP_MAIL_SD_FS.open(filePath.c_str(), FILE_WRITE); #endif - else if (imap->_storageType == esp_mail_file_storage_type_flash) + else if (imap->_config->storage.type == esp_mail_file_storage_type_flash) { #if defined(ESP_MAIL_FLASH_FS) #if defined(ESP32) @@ -6727,13 +6726,13 @@ void ESP_Mail_Client::decodeText(IMAPSession *imap, char *buf, int bufLen, int & { downloadRequest = true; - if (imap->_storageType == esp_mail_file_storage_type_sd) + if (imap->_config->storage.type == esp_mail_file_storage_type_sd) { #if defined(ESP_MAIL_SD_FS) file = ESP_MAIL_SD_FS.open(filePath.c_str(), FILE_WRITE); #endif } - else if (imap->_storageType == esp_mail_file_storage_type_flash) + else if (imap->_config->storage.type == esp_mail_file_storage_type_flash) { #if defined(ESP_MAIL_FLASH_FS) #if defined(ESP32) @@ -6765,7 +6764,7 @@ void ESP_Mail_Client::prepareFilePath(IMAPSession *imap, std::string &filePath, fpath += tmp; delS(tmp); - if (imap->_storageType == esp_mail_file_storage_type_sd) + if (imap->_config->storage.type == esp_mail_file_storage_type_sd) if (!ESP_MAIL_SD_FS.exists(fpath.c_str())) createDirs(fpath); diff --git a/src/ESP_Mail_Client.h b/src/ESP_Mail_Client.h index c5b63307..4e9b28f6 100644 --- a/src/ESP_Mail_Client.h +++ b/src/ESP_Mail_Client.h @@ -1,17 +1,16 @@ #ifndef ESP_Mail_Client_H #define ESP_Mail_Client_H -#define ESP_MAIL_VERSION "1.5.1" +#define ESP_MAIL_VERSION "1.5.2" /** * Mail Client Arduino Library for Espressif's ESP32 and ESP8266 and SAMD21 with u-blox NINA-W102 WiFi/Bluetooth module * - * Version: 1.5.1 + * Version: 1.5.2 * Released: September 14, 2021 * * Updates: - * - Fix the IMAP issue #94, undetected attachments and unable to download since v1.3.3 to v1.5.0. - * - Defer the IMAP polling error report. + * - Fix the IMAP issue #94, unable to save file to SD media since v1.3.3 to v1.5.1. * * * This library allows Espressif's ESP32, ESP8266 and SAMD devices to send and read Email through the SMTP and IMAP servers. @@ -2687,7 +2686,6 @@ class IMAPSession esp_mail_imap_command _imap_cmd = esp_mail_imap_command::esp_mail_imap_cmd_login; std::vector _multipart_levels = std::vector(); int _rfc822_part_count = 0; - esp_mail_file_storage_type _storageType = esp_mail_file_storage_type::esp_mail_file_storage_type_flash; bool _unseen = false; bool _readOnlyMode = true; struct esp_mail_auth_capability_t _auth_capability; diff --git a/src/ESP_Mail_FS.h b/src/ESP_Mail_FS.h index 67dc2570..f26788ea 100644 --- a/src/ESP_Mail_FS.h +++ b/src/ESP_Mail_FS.h @@ -31,7 +31,6 @@ #define CARD_TYPE_SD_MMC 1 * */ - #define ESP_Mail_DEFAULT_SD_FS SD #define CARD_TYPE_SD 1