Quantcast
Channel: Active questions tagged email - Stack Overflow
Viewing all articles
Browse latest Browse all 29918

How to log each phpmail() onto a text/log file

$
0
0

I want a copy of each email sent from my HTML online form to create a log file in my server root filepath, which each phpmail() sent, adding to the log file.

I am using the current php post file. Is there any method to do it?

<?php
$webmaster_email = ("myemail@domain.co.uk");

$email_address = $_REQUEST['email'] ;
$comments = $_REQUEST['comment'] ;
$telephone = $_REQUEST['telephone'] ;
$first_name = $_REQUEST['name'] ;
$msg = 
"Name: " . $first_name . "\r\n" . 
"Email: " . $email_address . "\r\n" . "\r\n" .
"Phone No: " . $telephone . "\r\n" . "\r\n" .     
"Comments: " . $comments ;
    mail( "$webmaster_email", "Contact Form Results", $msg );
?>

So basically all the Request statements and current time/date into a log file, is this even possible with php?


Viewing all articles
Browse latest Browse all 29918

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>