You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
881 B
36 lines
881 B
#include <smtpd/request.hpp>
|
|
|
|
#include <vector>
|
|
#include <string>
|
|
|
|
using namespace std;
|
|
|
|
namespace smtpd {
|
|
void Request::proceed() {
|
|
send("filter-result", {"proceed"});
|
|
}
|
|
|
|
void Request::junk() {
|
|
send("filter-result", {"junk"});
|
|
}
|
|
|
|
void Request::fail(string response) {
|
|
send("filter-result", {"disconnect", response});
|
|
}
|
|
|
|
void Request::submitMail(const Mail & mail) {
|
|
submitMailSection(mail.header, false);
|
|
submitMailSection(mail.body, true);
|
|
}
|
|
|
|
void Request::submitMailSection(const vector<string> & lines, bool isBody) {
|
|
for(auto line : lines) {
|
|
submitDataLine(line, isBody);
|
|
}
|
|
submitDataLine(isBody ? "." : "", false);
|
|
}
|
|
|
|
void Request::submitDataLine(string line, bool inBody) {
|
|
send("filter-dataline", {inBody && line == "." ? ".." : line});
|
|
}
|
|
}
|
|
|