Sending mail from form with PHP

Hi

I created a webform on an HTML page. When submit is hit, it’s send to a specific php file.
When I test this, I see my php code after clicking on submit and don’t receive a mail. What did I do wrong?
My code:

<?php // Get the submitted form data $naam = "Naam: ".$_POST["deelnemer"]." ".$_POST["Voornaam"]." ".$_POST["Naam"].""; $geboortedatum = "Geboortedatum:".$_POST["Geboortedatum"].""; $adres = "Adres:".$_POST["Straatnaam"]." ".$_POST["Huisnummer"].", ".$_POST["Postcode"]." ".$_POST[Gemeente]." - ".$_POST["deelnemer1_land"].""; $gsm = "GSM-nummer: ".$_POST["GSM nummer"].""; $ice = "ICE nummer: ".$_POST["ICE nummer"].""; $email = "Email: ".$_POST["E-mail"].""; $hond1 = "Naam hond 1: ".$_POST["Hond1"].""; $geboortehond1 = "Geboortedatum hond 1: ".$_POST["Hond1_geboortemaand"]." ".$_POST["Hond1_geboortejaar"].""; $hond2 = "Naam hond 2: ".$_POST["Hond2"].""; $geboortehond2 = "Geboortedatum hond 2: ".$_POST["Hond2_geboortemaand"]." ".$_POST["Hond2_geboortejaar"].""; $spaghetti = "Spaghetti: ".$_POST["Spaghetti"].""; $kaart = "Kaartlezen: ".$_POST["Kaartlezen"].""; $slaap = "Slaapmogelijkheid: ".$_POST["Slaapmogelijkheid"].""; $opm = "Opmerkingen: ".nl2br($_POST["Opmerkingen"]).""; // Check whether submitted data is not empty // Recipient email $toEmail = '[email protected]'; // i blurred this $emailSubject = 'nieuwe inschrijving'; $htmlContent = '

Nieuwe inschrijving voor de dogtrekking

'.$naam.'

'.$geboortedatum.'

'.$adres.'

'.$gsm.'

'.$ice.'

'.$email.'

'.$hond1.'

'.$geboortehond1.'

'.$hond2.'

'.$geboortehond2.'

'.$spaghetti.'

'.$kaart.'

'.$slaap.'

'.$opm.'

'; // Set content-type header for sending HTML email $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n"; // Additional headers $headers .= 'From: '.$name.'<'.$email.'>'. "\r\n"; // Send email if(mail($toEmail,$emailSubject,$htmlContent,$headers)){ $statusMsg = 'Uw inzending werd goed verzonden!'; }else{ $statusMsg = 'Er is een probleem met de inzending, neem contact op met de beheerder.'; } } } } ?>
When I test this, I see my php code

Then you are not running this through the server and are accessing it via file protocol file:// and not web http://localhost

Sponsor our Newsletter | Privacy Policy | Terms of Service