Bunch of changes.

This commit is contained in:
brad Arant committed 2025-07-03 12:01:16 -07:00
1 parent 0a4d17e6e6
commit 641368ea85
15 files changed
+441 -1327

No files matched your search

+31 -2
View File
@@ -9,12 +9,41 @@
#include "SMTPServer.h"
#include "POP3Server.h"
#include "IMAPServer.h"
#include "SendMail2.h"
#include <fcntl.h>
#include <iostream>
int main(int argc, char **argv) {
coreutils::Log(new coreutils::File("/var/log/barantmail.log", O_WRONLY | O_APPEND | O_CREAT, 0644));
coreutils::Log(coreutils::LOG_INFO) << "BMAMAIL called with link " << argv[0];
std::string arg = argv[0];
if(arg.substr(arg.find_last_of("\\/") + 1) == "sendmail2") {
try {
coreutils::Log(coreutils::LOG_INFO) << "Starting Mail Injector. Build " << __DATE__ << " " << __TIME__;
char buffer[1000000];
int index = 0;
int len = 0;
while((len = read(0, &buffer[index], 1000000)) > 0)
index += len;
coreutils::MString message(buffer, index);
coreutils::Log(coreutils::LOG_DEBUG_1) << "Number of bytes read: " << index;
core::EPoll ePoll;
ePoll.start(1, 1000);
mail::SendMail2 mail2(ePoll, argv[1], argv[2], message);
mail2.send();
coreutils::Log(coreutils::LOG_DEBUG_1) << "waiting...";
coreutils::MString rc(mail2.wait());
coreutils::Log(coreutils::LOG_DEBUG_1) << "rc: " << rc;
std::cout << rc;
}
catch(coreutils::Exception exception) {
std::cout << exception.text << " Error reason is '" << strerror(exception.errorNumber) << "' in file " << exception.file << " at line " << exception.line << std::endl;
}
} else {
try {
coreutils::Log(new coreutils::File("/var/log/mail.log", O_WRONLY | O_APPEND | O_CREAT, 0644));
coreutils::Log(coreutils::LOG_INFO) << "BMAMail Server starting. Build " << __DATE__ << " " << __TIME__;
std::string hostName = "localhost";
@@ -42,5 +71,5 @@ int main(int argc, char **argv) {
catch(coreutils::Exception exception) {
std::cout << exception.text << " Error reason is '" << strerror(exception.errorNumber) << "' in file " << exception.file << " at line " << exception.line << std::endl;
}
}
}