Posts

Showing posts with the label php send email from form

PHP Mail script to deliver HTML Form data

In your form settings set your action as your link to PHP acript handling the data and your method as POST $name = $_POST['name']; $from = $_POST['email']; $d8time = date("d/m/Y H:i:s"); $to = "brendan@br3nd4nc.blogspot.com"; $subject = "Website Enquiry $d8time"; $headers   = "From: $name <noreply@br3nd4nc.blogspot.com>\r\n";  $headers .= "Content-type: text/html;charset=UTF-8\r\n"; $headers .= "Reply-To: $from\r\n"; $message = "Hello World"; $confirm = mail($to,$subject,$message,$headers); if ($confirm) { print "<script>window.location.replace('http://br3nd4nc.blogspot.com');</script>\n"; } else { print "<h2>Error</h2>"; $errorMessage = error_get_last()['message']; print $errorMessage; //print phpinfo();   }