Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* 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; //RD change this PORT to whatever your email service uses
- const char* SMTP_SERVER = "smtp.gmail.com"; // RD: change this to whatever your email service is
- const char* EMAILBASE64_LOGIN = "***"; // RD: replace the *** with your login name in Base64
- const char* EMAILBASE64_PASSWORD = "***"; // RD: replace the *** with your login password in Base64
- const char* FROM = "***"; // RD replace the *** with whatever name you want the mail to be 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();
- };
- #endif // G_SENDER
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement