summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/tools/anopesmtp.cpp15
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");
}