From 00c196ea715f76adce1b5e2f47c01d547736dcea Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Wed, 9 Jan 2019 00:32:17 +0100 Subject: [PATCH] contact: save email contents to log file Backup in case of undelivered or otherwise lost messages. --- widget/contact.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/widget/contact.php b/widget/contact.php index de059ec..8fdc948 100644 --- a/widget/contact.php +++ b/widget/contact.php @@ -79,6 +79,12 @@ switch ($source) { $body .= "$k: $v\r\n"; } + if ($logfile = fopen('maillog.txt', 'a')) { + $logdata = "Date: ".strftime("%F %T"); + $logdata .= "\nTo: $rcpt\nSubject: $subject\n$header\n\n$body.\n\n"; + fwrite($logfile, str_replace("\r\n", "\n", $logdata)); + } + $sent = mail($rcpt, $subject, $body, $header); if (!$sent) return 'Helaas ging er iets mis bij het doorvoeren. Probeer het later nog eens.'; -- 2.30.0