-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathSMTPClient.h
50 lines (37 loc) · 909 Bytes
/
SMTPClient.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef SMTPCLIENT_H
#define SMTPCLIENT_H
#include <Socket.h>
#define EMAIL_INIT 0
#define EMAIL_SENDING 1
#define EMAIL_SENT 2
#define EMAIL_FAIL 3
class SMTPClient: public Socket{
char* user;
char* pass;
uint8_t status;
uint8_t protocolState;
char* to;
char* from;
char* subject;
char* body;
char recvLine[40];
void onLineReceived(char* line);
bool checkMessage(const char*,const char*);
bool checkCode(char*,uint16_t);
protected:
void onEstablished();
bool onDataReceived(Buffer* buf);
void onReadyToSend();
void onRemoteClosed();
void onClosed();
void onReset(bool resetByRemoteHost);
public:
SMTPClient(char* server, DNSHandler* dns, uint16_t port = 25,
char* username = NULL,
char* password = NULL);
~SMTPClient();
bool readyToEmail();
bool email(char* from, char* to, char* subject, char* body);
uint8_t getStatus();
};
#endif