diff options
author | Adam <adam@sigterm.info> | 2016-09-25 14:35:43 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-25 14:35:43 -0400 |
commit | 0c7050c506446cd73c0cf4f578945419139c5438 (patch) | |
tree | 31b04839c9f9cd881dec3e9040c437581bfd48c0 | |
parent | d02b3c1c45c8401855675158a535e8d90734ddaa (diff) | |
parent | e23cf0c221eb8380f56f4f2e246db60dba29cadb (diff) |
Merge pull request #175 from genius3000/2.0-email-date_header
Added a Date field to the Header
-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"); } |