-
Notifications
You must be signed in to change notification settings - Fork 1
/
Gsender.h
36 lines (34 loc) · 1.23 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
//#define GS_SERIAL_LOG_2 // Print to Serial client commands and server responce
#include <WiFiClientSecure.h>
class Gsender
{
protected:
Gsender();
private:
const int SMTP_PORT = 465;
const char* SMTP_SERVER = "smtp.gmail.com";
const char* EMAILBASE64_LOGIN = "Z2FtZWxpbmZhYmllbkBnbWFpbC5jb20=";
const char* EMAILBASE64_PASSWORD = "bGFjYW5hdW9jZWFuMzM=";
const char* FROM = "[email protected]";
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();
};
#endif // G_SENDER