contact: save email contents to log file
[minimedit.git] / widget / contact.php
index de059ec4a2405ac46ebc5ca0f35e5a60f74a6233..8fdc948f21a76af8b02f0038e51af47c8cb88dc8 100644 (file)
@@ -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.';