Skip to content

Commit

Permalink
Update Examples.
Browse files Browse the repository at this point in the history
  • Loading branch information
mobizt committed Mar 27, 2022
1 parent c4b81ef commit e41877c
Show file tree
Hide file tree
Showing 29 changed files with 407 additions and 212 deletions.
20 changes: 15 additions & 5 deletions examples/IMAP/Copy_Messages/Copy_Messsages.ino
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
*
*/

/** For Gmail, IMAP option should be enabled. https://support.google.com/mail/answer/7126229?hl=en
* and also https://accounts.google.com/b/0/DisplayUnlockCaptcha
*/

/** For ESP8266, with BearSSL WiFi Client
* The memory reserved for completed valid SSL response from IMAP is 16 kbytes which
* may cause your device out of memory reset in case the memory
Expand All @@ -26,7 +22,7 @@
#include <ESP8266WiFi.h>
#else

//other Client defined here
//Other Client defined here
//To use custom Client, define ENABLE_CUSTOM_CLIENT in src/ESP_Mail_FS.h.
//See the example Custom_Client.ino for how to use.

Expand All @@ -39,6 +35,20 @@
#define WIFI_SSID "<ssid>"
#define WIFI_PASSWORD "<password>"

/** For Gmail, IMAP option should be enabled. https://support.google.com/mail/answer/7126229?hl=en
* and also https://accounts.google.com/b/0/DisplayUnlockCaptcha
*
* Some Gmail user still not able to sign in using account password even above options were set up,
* for this case, use "App Password" to sign in instead.
* About Gmail "App Password", go to https://support.google.com/accounts/answer/185833?hl=en
*
* For Yahoo mail, log in to your yahoo mail in web browser and generate app password by go to
* https://login.yahoo.com/account/security/app-passwords/add/confirm?src=noSrc
*
* To use Gmai and Yahoo's App Password to sign in, define the AUTHOR_PASSWORD with your App Password
* and AUTHOR_EMAIL with your account email.
*/

/* The imap host name e.g. imap.gmail.com for GMail or outlook.office365.com for Outlook */
#define IMAP_HOST "<host>"

Expand Down
18 changes: 14 additions & 4 deletions examples/IMAP/Custom_Client/Custom_Client.ino
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@
/** This example shows how to read E-mail with external Client.
* This example used SAMD21 device and WiFiNINA as the client.
* Other Arduino Clients e.g. WiFiClient, EthernetClient and GSMClient can be used.
*/

/** For Gmail, to send the Email via port 465 (SSL), less secure app option
* should be enabled in the account settings. https://myaccount.google.com/lesssecureapps?pli=1
*/

#include <Arduino.h>
Expand All @@ -31,6 +27,20 @@
#define WIFI_SSID "<ssid>"
#define WIFI_PASSWORD "<password>"

/** For Gmail, IMAP option should be enabled. https://support.google.com/mail/answer/7126229?hl=en
* and also https://accounts.google.com/b/0/DisplayUnlockCaptcha
*
* Some Gmail user still not able to sign in using account password even above options were set up,
* for this case, use "App Password" to sign in instead.
* About Gmail "App Password", go to https://support.google.com/accounts/answer/185833?hl=en
*
* For Yahoo mail, log in to your yahoo mail in web browser and generate app password by go to
* https://login.yahoo.com/account/security/app-passwords/add/confirm?src=noSrc
*
* To use Gmai and Yahoo's App Password to sign in, define the AUTHOR_PASSWORD with your App Password
* and AUTHOR_EMAIL with your account email.
*/

/* The imap host name e.g. imap.gmail.com for GMail or outlook.office365.com for Outlook */
#define IMAP_HOST "<host>"

Expand Down
20 changes: 15 additions & 5 deletions examples/IMAP/Custom_Command/Custom_Command.ino
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
*
*/

/** For Gmail, IMAP option should be enabled. https://support.google.com/mail/answer/7126229?hl=en
* and also https://accounts.google.com/b/0/DisplayUnlockCaptcha
*/

/** For ESP8266, with BearSSL WiFi Client
* The memory reserved for completed valid SSL response from IMAP is 16 kbytes which
* may cause your device out of memory reset in case the memory
Expand All @@ -26,7 +22,7 @@
#include <ESP8266WiFi.h>
#else

//other Client defined here
//Other Client defined here
//To use custom Client, define ENABLE_CUSTOM_CLIENT in src/ESP_Mail_FS.h.
//See the example Custom_Client.ino for how to use.

Expand All @@ -39,6 +35,20 @@
#define WIFI_SSID "<ssid>"
#define WIFI_PASSWORD "<password>"

/** For Gmail, IMAP option should be enabled. https://support.google.com/mail/answer/7126229?hl=en
* and also https://accounts.google.com/b/0/DisplayUnlockCaptcha
*
* Some Gmail user still not able to sign in using account password even above options were set up,
* for this case, use "App Password" to sign in instead.
* About Gmail "App Password", go to https://support.google.com/accounts/answer/185833?hl=en
*
* For Yahoo mail, log in to your yahoo mail in web browser and generate app password by go to
* https://login.yahoo.com/account/security/app-passwords/add/confirm?src=noSrc
*
* To use Gmai and Yahoo's App Password to sign in, define the AUTHOR_PASSWORD with your App Password
* and AUTHOR_EMAIL with your account email.
*/

/* The imap host name e.g. imap.gmail.com for GMail or outlook.office365.com for Outlook */
#define IMAP_HOST "<host>"

Expand Down
20 changes: 15 additions & 5 deletions examples/IMAP/Delete_Messages/Delete_Messsages.ino
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
*
*/

/** For Gmail, IMAP option should be enabled. https://support.google.com/mail/answer/7126229?hl=en
* and also https://accounts.google.com/b/0/DisplayUnlockCaptcha
*/

/** For ESP8266, with BearSSL WiFi Client
* The memory reserved for completed valid SSL response from IMAP is 16 kbytes which
* may cause your device out of memory reset in case the memory
Expand All @@ -26,7 +22,7 @@
#include <ESP8266WiFi.h>
#else

//other Client defined here
//Other Client defined here
//To use custom Client, define ENABLE_CUSTOM_CLIENT in src/ESP_Mail_FS.h.
//See the example Custom_Client.ino for how to use.

Expand All @@ -39,6 +35,20 @@
#define WIFI_SSID "<ssid>"
#define WIFI_PASSWORD "<password>"

/** For Gmail, IMAP option should be enabled. https://support.google.com/mail/answer/7126229?hl=en
* and also https://accounts.google.com/b/0/DisplayUnlockCaptcha
*
* Some Gmail user still not able to sign in using account password even above options were set up,
* for this case, use "App Password" to sign in instead.
* About Gmail "App Password", go to https://support.google.com/accounts/answer/185833?hl=en
*
* For Yahoo mail, log in to your yahoo mail in web browser and generate app password by go to
* https://login.yahoo.com/account/security/app-passwords/add/confirm?src=noSrc
*
* To use Gmai and Yahoo's App Password to sign in, define the AUTHOR_PASSWORD with your App Password
* and AUTHOR_EMAIL with your account email.
*/

/* The imap host name e.g. imap.gmail.com for GMail or outlook.office365.com for Outlook */
#define IMAP_HOST "<host>"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
*
*/

/** For Gmail, IMAP option should be enabled. https://support.google.com/mail/answer/7126229?hl=en
* and also https://accounts.google.com/b/0/DisplayUnlockCaptcha
*/

/** For ESP8266, with BearSSL WiFi Client
* The memory reserved for completed valid SSL response from IMAP is 16 kbytes which
* may cause your device out of memory reset in case the memory
Expand All @@ -26,7 +22,7 @@
#include <ESP8266WiFi.h>
#else

//other Client defined here
//Other Client defined here
//To use custom Client, define ENABLE_CUSTOM_CLIENT in src/ESP_Mail_FS.h.
//See the example Custom_Client.ino for how to use.

Expand All @@ -39,6 +35,20 @@
#define WIFI_SSID "<ssid>"
#define WIFI_PASSWORD "<password>"

/** For Gmail, IMAP option should be enabled. https://support.google.com/mail/answer/7126229?hl=en
* and also https://accounts.google.com/b/0/DisplayUnlockCaptcha
*
* Some Gmail user still not able to sign in using account password even above options were set up,
* for this case, use "App Password" to sign in instead.
* About Gmail "App Password", go to https://support.google.com/accounts/answer/185833?hl=en
*
* For Yahoo mail, log in to your yahoo mail in web browser and generate app password by go to
* https://login.yahoo.com/account/security/app-passwords/add/confirm?src=noSrc
*
* To use Gmai and Yahoo's App Password to sign in, define the AUTHOR_PASSWORD with your App Password
* and AUTHOR_EMAIL with your account email.
*/

/* The imap host name e.g. imap.gmail.com for GMail or outlook.office365.com for Outlook */
#define IMAP_HOST "<host>"

Expand Down
20 changes: 15 additions & 5 deletions examples/IMAP/Read_Email_Access_Token/Read_Email_Access_Token.ino
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@
*
*/

/** For Gmail, IMAP option should be enabled. https://support.google.com/mail/answer/7126229?hl=en
* and also https://accounts.google.com/b/0/DisplayUnlockCaptcha
*/

/** For ESP8266, with BearSSL WiFi Client
* The memory reserved for completed valid SSL response from IMAP is 16 kbytes which
* may cause your device out of memory reset in case the memory
Expand All @@ -28,7 +24,7 @@
#include <ESP8266WiFi.h>
#else

//other Client defined here
//Other Client defined here
//To use custom Client, define ENABLE_CUSTOM_CLIENT in src/ESP_Mail_FS.h.
//See the example Custom_Client.ino for how to use.

Expand All @@ -41,6 +37,20 @@
#define WIFI_SSID "<ssid>"
#define WIFI_PASSWORD "<password>"

/** For Gmail, IMAP option should be enabled. https://support.google.com/mail/answer/7126229?hl=en
* and also https://accounts.google.com/b/0/DisplayUnlockCaptcha
*
* Some Gmail user still not able to sign in using account password even above options were set up,
* for this case, use "App Password" to sign in instead.
* About Gmail "App Password", go to https://support.google.com/accounts/answer/185833?hl=en
*
* For Yahoo mail, log in to your yahoo mail in web browser and generate app password by go to
* https://login.yahoo.com/account/security/app-passwords/add/confirm?src=noSrc
*
* To use Gmai and Yahoo's App Password to sign in, define the AUTHOR_PASSWORD with your App Password
* and AUTHOR_EMAIL with your account email.
*/

/* The imap host name e.g. imap.gmail.com for GMail or outlook.office365.com for Outlook */
#define IMAP_HOST "<host>"

Expand Down
40 changes: 25 additions & 15 deletions examples/IMAP/Read_Single_Email/Read_Single_Email.ino
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@
*
*/

/** For Gmail, IMAP option should be enabled. https://support.google.com/mail/answer/7126229?hl=en
* and also https://accounts.google.com/b/0/DisplayUnlockCaptcha
*/


/** Assign SD card type and FS used in src/ESP_Mail_FS.h and
* change the config for that card interfaces in src/addons/SDHelper.h
*/
Expand All @@ -25,7 +20,7 @@
#include <ESP8266WiFi.h>
#else

//other Client defined here
//Other Client defined here
//To use custom Client, define ENABLE_CUSTOM_CLIENT in src/ESP_Mail_FS.h.
//See the example Custom_Client.ino for how to use.

Expand All @@ -39,6 +34,20 @@
#define WIFI_SSID "<ssid>"
#define WIFI_PASSWORD "<password>"

/** For Gmail, IMAP option should be enabled. https://support.google.com/mail/answer/7126229?hl=en
* and also https://accounts.google.com/b/0/DisplayUnlockCaptcha
*
* Some Gmail user still not able to sign in using account password even above options were set up,
* for this case, use "App Password" to sign in instead.
* About Gmail "App Password", go to https://support.google.com/accounts/answer/185833?hl=en
*
* For Yahoo mail, log in to your yahoo mail in web browser and generate app password by go to
* https://login.yahoo.com/account/security/app-passwords/add/confirm?src=noSrc
*
* To use Gmai and Yahoo's App Password to sign in, define the AUTHOR_PASSWORD with your App Password
* and AUTHOR_EMAIL with your account email.
*/

/* The imap host name e.g. imap.gmail.com for GMail or outlook.office365.com for Outlook */
#define IMAP_HOST "<host>"

Expand Down Expand Up @@ -140,15 +149,6 @@ void setup()
/* Setup the configuration for searching or fetching operation and its result */
IMAP_Config config;

/* Set seen flag */
//config.fetch.set_seen = true;

/* Search criteria */
config.search.criteria.clear();

/* Also search the unseen message */
config.search.unseen_msg = true;

/* Set the storage to save the downloaded files and attachments */
config.storage.saved_path = F("/email_data");

Expand Down Expand Up @@ -222,6 +222,16 @@ void setup()
*/
config.fetch.uid = imap.getUID(imap.selectedFolder().msgCount());

/* Set seen flag */

// The message with "Seen" flagged means the message was already read or seen by user.
// The default value of this option is set to false.
// If you want to set the message flag as "Seen", set this option to true.
// If this option is false, the message flag was unchanged.
// To set or remove flag from message, see Set_Flags.ino example.

// config.fetch.set_seen = true;

/* Read or search the Email and close the session */

//When message was fetched or read, the /Seen flag will not set or message remained in unseen or unread status,
Expand Down
20 changes: 15 additions & 5 deletions examples/IMAP/Read_Single_Email_Loop/Read_Single_Email_Loop.ino
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@
*
*/

/** For Gmail, IMAP option should be enabled. https://support.google.com/mail/answer/7126229?hl=en
* and also https://accounts.google.com/b/0/DisplayUnlockCaptcha
*/

/** For ESP8266, with BearSSL WiFi Client
* The memory reserved for completed valid SSL response from IMAP is 16 kbytes which
* may cause your device out of memory reset in case the memory
Expand All @@ -34,7 +30,7 @@
#include <ESP8266WiFi.h>
#else

//other Client defined here
//Other Client defined here
//To use custom Client, define ENABLE_CUSTOM_CLIENT in src/ESP_Mail_FS.h.
//See the example Custom_Client.ino for how to use.

Expand All @@ -48,6 +44,20 @@
#define WIFI_SSID "<ssid>"
#define WIFI_PASSWORD "<password>"

/** For Gmail, IMAP option should be enabled. https://support.google.com/mail/answer/7126229?hl=en
* and also https://accounts.google.com/b/0/DisplayUnlockCaptcha
*
* Some Gmail user still not able to sign in using account password even above options were set up,
* for this case, use "App Password" to sign in instead.
* About Gmail "App Password", go to https://support.google.com/accounts/answer/185833?hl=en
*
* For Yahoo mail, log in to your yahoo mail in web browser and generate app password by go to
* https://login.yahoo.com/account/security/app-passwords/add/confirm?src=noSrc
*
* To use Gmai and Yahoo's App Password to sign in, define the AUTHOR_PASSWORD with your App Password
* and AUTHOR_EMAIL with your account email.
*/

/* The imap host name e.g. imap.gmail.com for GMail or outlook.office365.com for Outlook */
#define IMAP_HOST "<host>"

Expand Down
20 changes: 15 additions & 5 deletions examples/IMAP/Search_Emails/Search_Emails.ino
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* This example shows how to search all messages in the opened mailbox folder.
* This example shows how to search all messages with the keywords in the opened mailbox folder.
*
* Created by K. Suwatchai (Mobizt)
*
Expand All @@ -11,10 +11,6 @@
*
*/

/** For Gmail, IMAP option should be enabled. https://support.google.com/mail/answer/7126229?hl=en
* and also https://accounts.google.com/b/0/DisplayUnlockCaptcha
*/

/** For ESP8266, with BearSSL WiFi Client
* The memory reserved for completed valid SSL response from IMAP is 16 kbytes which
* may cause your device out of memory reset in case the memory
Expand All @@ -39,6 +35,20 @@
#define WIFI_SSID "<ssid>"
#define WIFI_PASSWORD "<password>"

/** For Gmail, IMAP option should be enabled. https://support.google.com/mail/answer/7126229?hl=en
* and also https://accounts.google.com/b/0/DisplayUnlockCaptcha
*
* Some Gmail user still not able to sign in using account password even above options were set up,
* for this case, use "App Password" to sign in instead.
* About Gmail "App Password", go to https://support.google.com/accounts/answer/185833?hl=en
*
* For Yahoo mail, log in to your yahoo mail in web browser and generate app password by go to
* https://login.yahoo.com/account/security/app-passwords/add/confirm?src=noSrc
*
* To use Gmai and Yahoo's App Password to sign in, define the AUTHOR_PASSWORD with your App Password
* and AUTHOR_EMAIL with your account email.
*/

/* The imap host name e.g. imap.gmail.com for GMail or outlook.office365.com for Outlook */
#define IMAP_HOST "<host>"

Expand Down
Loading

0 comments on commit e41877c

Please sign in to comment.