Tasmota/tasmota/sendemail_ESP8266.h

33 lines
875 B
C
Raw Normal View History

2019-09-04 19:58:17 +01:00
#ifndef __SENDEMAIL_H
#define __SENDEMAIL_H
//#define DEBUG_EMAIL_PORT
#include <base64.h>
2019-10-14 09:14:17 +01:00
#include "WiFiClientSecureLightBearSSL.h"
2019-09-04 19:58:17 +01:00
class SendEmail
{
private:
const String host;
const int port;
const String user;
const String passwd;
const int timeout;
const bool ssl;
const int auth_used;
// use bear ssl
2019-10-14 09:14:17 +01:00
BearSSL::WiFiClientSecure_light *client;
2020-04-12 18:28:19 +01:00
2019-09-04 19:58:17 +01:00
String readClient();
void a3_to_a4(unsigned char * a4, unsigned char * a3);
int base64_encode(char *output, const char *input, int inputLen);
public:
SendEmail(const String& host, const int port, const String& user, const String& passwd, const int timeout, const int auth_used);
2019-10-18 10:33:52 +01:00
bool send(const String& from, const String& to, const String& subject, const char *msg);
2020-05-02 07:10:23 +01:00
void send_message_txt(char *msg);
2019-09-04 19:58:17 +01:00
~SendEmail() {client->stop(); delete client;}
};
#endif