36 lines
907 B
C++
36 lines
907 B
C++
#include "__SMTP_MAIL.h"
|
|
#include "SMTPSession.h"
|
|
|
|
#define CRLF "\r\n"
|
|
|
|
namespace mail {
|
|
|
|
int __SMTP_MAIL::processCommand(coreutils::ZString &request, core::TCPSession &session) {
|
|
|
|
SMTPSession &s = dynamic_cast<SMTPSession &>(session);
|
|
|
|
if(request.ifNext("MAIL FROM:")) {
|
|
request.skipWhitespace();
|
|
if(request.ifNext("<")) {
|
|
s.sender = request.getTokenExclude(">");
|
|
if(s.authState = USER_KNOWN) {
|
|
s.out << "250 OK" << CRLF;
|
|
s.recipientList.clear();
|
|
s.state = MAIL;
|
|
}
|
|
} else
|
|
s.out << "550 Usage: MAIL FROM:<email-address>" << CRLF;
|
|
} else
|
|
s.out << "550 Usage: MAIL FROM:<email-address>" << CRLF;
|
|
return 1;
|
|
}
|
|
|
|
std::string domainOnly(std::string email) {
|
|
coreutils::ZString split(email);
|
|
split.split("@");
|
|
return split[1].str();
|
|
}
|
|
|
|
}
|
|
|