From: Mischa POSLAWSKY Date: Tue, 8 Jan 2019 23:32:17 +0000 (+0100) Subject: contact: save email contents to log file X-Git-Tag: v5.2~5 X-Git-Url: http://git.shiar.nl/minimedit.git/commitdiff_plain/00c196ea715f76adce1b5e2f47c01d547736dcea contact: save email contents to log file Backup in case of undelivered or otherwise lost messages. --- 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.';