Advertisement
DevUModerator

Untitled

Dec 11th, 2018
653
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. /* Gsender class helps send e-mails from Gmail account
  2. * using Arduino core for ESP8266 WiFi chip
  3. * by Boris Shobat
  4. * September 29 2016
  5. */
  6. #ifndef G_SENDER
  7. #define G_SENDER
  8. #define GS_SERIAL_LOG_1 // Print to Serial only server responce
  9. //#define GS_SERIAL_LOG_2 // Print to Serial client commands and server responce
  10. #include <WiFiClientSecure.h>
  11.  
  12. class Gsender
  13. {
  14. protected:
  15. Gsender();
  16. private:
  17. const int SMTP_PORT = 465; //RD change this PORT to whatever your email service uses
  18. const char* SMTP_SERVER = "smtp.gmail.com"; // RD: change this to whatever your email service is
  19. const char* EMAILBASE64_LOGIN = "***"; // RD: replace the *** with your login name in Base64
  20. const char* EMAILBASE64_PASSWORD = "***"; // RD: replace the *** with your login password in Base64
  21. const char* FROM = "***"; // RD replace the *** with whatever name you want the mail to be FROM
  22. const char* _error = nullptr;
  23. char* _subject = nullptr;
  24. String _serverResponce;
  25. static Gsender* _instance;
  26. bool AwaitSMTPResponse(WiFiClientSecure &client, const String &resp = "", uint16_t timeOut = 10000);
  27.  
  28. public:
  29. static Gsender* Instance();
  30. Gsender* Subject(const char* subject);
  31. Gsender* Subject(const String &subject);
  32. bool Send(const String &to, const String &message);
  33. String getLastResponce();
  34. const char* getError();
  35. };
  36. #endif // G_SENDER
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement