Compilable SMTP

This commit is contained in:
Brad Arant committed 2022-07-08 19:30:00 -07:00
1 parent 6c844983d9
commit e1f33291f7
70 files changed
+308 -362

No files matched your search

+13 -13
View File
@@ -25,7 +25,7 @@ namespace mail {
public:
SMTPServer(core::EPoll &ePoll, std::string hostName, MailFileSystem &mailFileSystem, core::IPAddress ipAddress)
: core::TCPServer(ePoll, ipAddress, "SMTP Server"), core::INotify(ePoll), hostName(hostName), mailFileSystem(mailFileSystem) {
: core::TCPServer(ePoll, ipAddress, " ", 10, "SMTP Server"), core::INotify(ePoll), hostName(hostName), mailFileSystem(mailFileSystem) {
commands.add(_smtp_auth, "AUTH");
commands.add(_smtp_data, "DATA");
commands.add(_smtp_ehlo, "EHLO");
@@ -49,23 +49,23 @@ namespace mail {
}
void sessionErrorHandler(std::string errorString, std::stringstream &out) {
out << "252 " << errorString << CRLF;
out << "252 " << errorString << CRLF;
}
protected:
void inCreate(std::string name) {
int pos = name.find(".") + 10;
std::string mail = name.substr(0, pos);
std::string recipient = name.substr(pos);
if(recipient != "") {
std::string fileName = mailPath + "/.queue/" + name;
std::string path = mailFileSystem.getMailBoxPath(recipient) + "/Inbox/" + mail;
int rc = link(fileName.c_str(), path.c_str());
rc = unlink(fileName.c_str());
coreutils::Log(coreutils::LOG_INFO) << "Message " << mail << " delivered to " << recipient << ".";
}
int pos = name.find(".") + 10;
std::string mail = name.substr(0, pos);
std::string recipient = name.substr(pos);
if(recipient != "") {
std::string fileName = mailPath + "/.queue/" + name;
std::string path = mailFileSystem.getMailBoxPath(recipient) + "/Inbox/" + mail;
int rc = link(fileName.c_str(), path.c_str());
rc = unlink(fileName.c_str());
coreutils::Log(coreutils::LOG_INFO) << "Message " << mail << " delivered to " << recipient << ".";
}
}
private:
__SMTP_AUTH _smtp_auth;
__SMTP_DATA _smtp_data;