I'm trying to send an email using php, but when I try it on browser I get error:
"The server failed to send the message. Please try again later."
Here is my php file
<?php
if( isset($_GET['n']) && isset($_GET['e']) && isset($_GET['m']) ){
$n = $_GET['n']; // HINT: use preg_replace() to filter the data
$e = $_GET['e'];
$m = nl2br($_GET['m']);
$to = "amal.soltni@esprit.tn";
$from = $e;
$subject = 'Contact Form Message';
$message = '<b>Name:</b> '.$n.' <br><b>Email:</b> '.$e.' <p>'.$m.'</p>';
$headers = "From: $from\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\n";
if( mail($to, $subject, $message, $headers) ){
echo "success";
} else {
echo "The server failed to send the message. Please try again later.";
}
}
?>