#ifndef __SMTPSession_h__ # define __SMTPSession_h__ # include "TCPSession.h" # include "TCPServer.h" # define CRLF "\r\n" namespace mail { enum State {CONNECT, READY, MAIL, RCPT, DATA}; enum AuthState {USER_UNKNOWN, USER_QUERY, USER_SECRET_QUERY, USER_KNOWN}; enum Mode {WAIT_FOR_DATA, RECEIVE_DATA}; class SMTPSession : public core::TCPSession { public: SMTPSession(core::EPoll &ePoll, core::TCPServer &server) : TCPSession(ePoll, server, "SMTP Client Session") {} void onConnected() override { out << "220 localhost BMAMail" << CRLF; } std::string clientDomainName; std::string userName; std::string password; std::stringstream mailData; State state = CONNECT; AuthState authState = USER_UNKNOWN; Mode mode = WAIT_FOR_DATA; bool relay = false; std::string sender; std::vector recipientList; }; } #endif