forked from cetrespeo/ESP32-E-Paper-Weather
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gsender.h
36 lines (34 loc) · 1.13 KB
/
Gsender.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/* Gsender class helps send e-mails from Gmail account
* using Arduino core for ESP8266 WiFi chip
* by Boris Shobat
* September 29 2016
*/
#ifndef G_SENDER
#define G_SENDER
#define GS_SERIAL_LOG_1 // Print to Serial only server responce
#include <WiFiClientSecure.h>
class Gsender
{
protected:
Gsender();
private:
const int SMTP_PORT = 465;
const char* SMTP_SERVER = "smtp.gmail.com";
String EMAILBASE64_LOGIN;
String EMAILBASE64_PASSWORD;
String FROM;
const char* _error = nullptr;
char* _subject = nullptr;
String _serverResponce;
static Gsender* _instance;
bool AwaitSMTPResponse(WiFiClientSecure &client, const String &resp = "", uint16_t timeOut = 10000);
public:
static Gsender* Instance();
Gsender* Subject(const char* subject);
Gsender* Subject(const String &subject);
bool Send(const String &to, const String &message);
String getLastResponce();
const char* getError();
bool SetParams(char* login, char* pass, char* email);
};
#endif // G_SENDER