Skip to content
This repository has been archived by the owner on Jan 10, 2021. It is now read-only.

Commit

Permalink
Support SPIFFS and fix file name bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
mobizt committed Jun 17, 2019
1 parent 31a3fb3 commit 1fc5cf6
Show file tree
Hide file tree
Showing 6 changed files with 222 additions and 87 deletions.
36 changes: 32 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Mail Client Arduino Library for ESP32 v 1.1.1
# Mail Client Arduino Library for ESP32 v 1.1.2

This library allows ESP32 to send Email with/without attachment and receive Email with/without attachment download via SMTP and IMAP servers.

Expand All @@ -23,13 +23,13 @@ This following devices were tested and work well.

* Support Email sending with or without attachment via IMAP server.

* Working with SD card allows large file attachment supported.
* Working with SD card allows large file attachment supported or SPIFFS for small file.

* Support Email reading via search and fetch modes (with or without attachment downloads).

* Support large attachment download via SD card.
* Support large attachment download via SD card or SPIFFS for small file.

* Message text and its header are able to download and save to SD card.
* Message text and its header are able to download and save to SD card or SPIFFS.

* Support Email message fetch and search via IMAP command as in RFC 3501 (depending on IMAP server implementation).

Expand Down Expand Up @@ -124,6 +124,7 @@ To set sender, use `smtpData.addRecipient` e.g. `smtpData.addRecipient("SOME_REC

To add attachment, use `smtpData.addAttachData` e.g. `smtpData.addAttachData("test.png", "image/png", (uint8_t *)imageData, sizeof imageData);`.


When completed all required message data, sending Email `MailClient.sendMail(http, smtpData)`.


Expand Down Expand Up @@ -482,6 +483,20 @@ void setFechUID(const String fetchUID);
**Set storage type to save download attached file or messages.**
param *`storageType`* - The storage type to save file, MailClientStorageType::SD or MailClientStorageType::SPIFFS
```C++
void setFileStorageType(uint8_t storageType);
```






**Enable/disable attachment download.**

param *`download`* - Boolean flag to enable/disable attachment download.
Expand Down Expand Up @@ -1522,6 +1537,19 @@ void removeAttachFile(const String &filePath);



**Set storage type for all attach files.**

param *`storageType`* - The storage type to read attach file, MailClientStorageType::SD or MailClientStorageType::SPIFFS.

```C++
void setFileStorageType(uint8_t storageType);
```
**Remove specified attachment file.**
param *`index`* - The index of the attachment file (count only file type attachment) to remove.
Expand Down
4 changes: 4 additions & 0 deletions examples/Receive_email/Receive_email.ino
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ void setup()
//Set to get attachment downloading progress status.
imapData.setDownloadReport(true);

//Set the storage types to save download attachments or messages (SD is default)
//imapData.setFileStorageType(MailClientStorageType::SPIFFS)
imapData.setFileStorageType(MailClientStorageType::SD);

MailClient.readMail(http, imapData);
}

Expand Down
7 changes: 6 additions & 1 deletion examples/Send_email/Send_email.ino
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void setup()

Serial.println("Mounting SD Card...");

if (SD.begin())
if (SD.begin()) // MailClient.sdBegin(14,2,15,13) for TTGO T8 v1.7 or 1.8
{

Serial.println("Preparing attach file...");
Expand Down Expand Up @@ -136,6 +136,11 @@ void setup()
smtpData.addAttachFile("/binary_file.dat");
smtpData.addAttachFile("/text_file.txt");

//Set the storage types to read the attach files (SD is default)
//smtpData.setFileStorageType(MailClientStorageType::SPIFFS);
smtpData.setFileStorageType(MailClientStorageType::SD);



smtpData.setSendCallback(sendCallback);

Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name=ESP32 Mail Client

version=1.1.1
version=1.1.2

author=Mobizt

Expand Down
Loading

0 comments on commit 1fc5cf6

Please sign in to comment.