The mail($to, $subject, $message, $from); function isn’t working in the code below.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
</head>
<body>
<?php
if ($_POST['Gender'] = 'M') {
$prefix = 'Mr.';
}else if($_POST['Gender'] = 'F') {
$prefix = 'Miss/ Mrs.';
}
$start1 = "The message: " . $_POST['Subject'] . "/n Was sent to you at " . date('l jS \of F Y h:i:s A');
$sender = "By: " . $prefix . " " . $_POST['Name'];
$content = "The message : /n /n" . $_POST['Massage'];
$sufix = "To reply to this email: " . $_POST['Email'];
$from = $_POST['Email'];
$to = "info@mybataba.com";
$subject = "You have a new massage on mybataba.com" . $_POST['Subject'];
$message = $start1 . $sender . $content . $sufix
mail ($to, $subject, $message, $from);
?>
</body>
</html>
You either have a programming issue (errors will be thrown)
OR
You need to confirm your mail settings are correct in
PHP.INI, it comes down to having your server software configured to SEND OUT MAIL, vs SENDING IN PHP.Once you make sure your server is configured properly your PHP
mail()will workEDIT
Just noticed too that you are missing a
;on this line: