diff options
author | genius3000 <genius3000@g3k.solutions> | 2016-08-16 17:12:25 -0600 |
---|---|---|
committer | genius3000 <genius3000@g3k.solutions> | 2016-08-17 10:22:44 -0600 |
commit | e23cf0c221eb8380f56f4f2e246db60dba29cadb (patch) | |
tree | ea57048f9b5f1bed3f904a5279b28d48411f0c32 /src/tools/anopesmtp.cpp | |
parent | 2a5e7827bde932cc632e2457964631982dd96fca (diff) |
Added a Date field to the Header
Diffstat (limited to 'src/tools/anopesmtp.cpp')
-rw-r--r-- | src/tools/anopesmtp.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/tools/anopesmtp.cpp b/src/tools/anopesmtp.cpp index 392c6e627..b0cf0847d 100644 --- a/src/tools/anopesmtp.cpp +++ b/src/tools/anopesmtp.cpp @@ -107,6 +107,18 @@ static std::string get_logname(struct tm *tm = NULL) return name; } +/* TimeStamp for Email Header */ +static std::string GetTimeStamp() +{ + char tbuf[256]; + time_t t = time(NULL); + struct tm *tm = localtime(&t); + + strftime(tbuf, sizeof(tbuf) - 1, "%a, %d %b %Y %H:%M:%S %z", tm); + + return tbuf; +} + /* Log stuff to the log file with a datestamp. Note that errno is * preserved by this routine and log_perror(). */ @@ -417,7 +429,7 @@ int main(int argc, char *argv[]) if (argc == 1) return 0; - + if (argc == 3 && !strcmp(argv[2], "--debug")) smtp_debug = 1; @@ -468,6 +480,7 @@ int main(int argc, char *argv[]) break; else { + smail.smtp_headers.push_back("Date: " + GetTimeStamp() + "\r\n"); headers_done = true; smail.smtp_body.push_back(strip(buf) + "\r\n"); } |