Issue with a contact form

Hello,

I have contact form on my website. It used to work well until now but my hosting server proceeded with a migration and now it does not work anymore. You will find here below the code. Upon being sent, no error is showing but nothing is sent??? Can anybody help me rewrite this to make it work? I tried several things already. I work on Global PHP version 5.6. I know it is outdated but this is what I have now. I can share the link privately. Let me know.

<?php
//variable formulaire envoi
$name=htmlspecialchars($_POST['name']);
$company=htmlspecialchars($_POST['company']);
$email=htmlspecialchars($_POST['email']);
$telephone=htmlspecialchars($_POST['telephone']);
$type=htmlspecialchars($_POST['type']);
$question=htmlspecialchars($_POST['message']);

//variables mail
$headers ='From: "A&T website"<webmaster@abcd.com>'."\n";
$headers .='Content-Type: text/html; charset="utf-8"'."\n";
$headers .='Content-Transfer-Encoding: 8bit';

//corps message
$message="
<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 'http://www.w3.org/TR/html4/loose.dtd'>
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
<title>Website Contact</title>
<style type='text/css'>
<!--
body {
background-color: #EEE;
font-family: Tahoma, Geneva, sans-serif;
font-size: 13px;
}
hr {
height:1px;
}
-->
</style>
</head>
<body>
<table width='650' border='0' align='center' cellpadding='0' cellspacing='0' bgcolor='#FFFFFF'>

<tr>
<td width='25' height='60'>&nbsp;</td>
<td width='600' valign='top'><p><img src='http://www.abcd/abcd_logo.png' align='left'><br><br></p></td>
<td width='25'>&nbsp;</td>
</tr>
<tr>
<td height='292'>&nbsp;</td>
<td valign='top'><strong><u>Website Contact</u></strong><br><br>
<table width='602' border='0' align='center'>
<tr align='left'>
<td width='81'><strong>Name :</strong></td>
<td>". $name ."</td>
<td width='100'><strong>Email :</strong></td>
<td width='182'>". $email ."</td>
</tr>
<tr align='left'>
<td><strong>Company</strong></td>
<td width='249'>". $company ."</td>
<td><strong>Phone</strong></td>
<td>". $phone ."</td>
</tr>

</table>
<hr noshade color='#683d14' size='1px' width='90%'>
<strong>Type : </strong> ". $type ." <br />
<strong>Message :</strong><br />
". $question ."
</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td align='center'><span style='color:#999'>abcd - 2015</span></td>
<td>&nbsp;</td>
</tr>
</table>
</body>
</html>
";

if ( ereg('lkinser@gmail.com|rtuuil@gmail.com|rtyuol@gmail.com|ertyuol@gmail.com',$emmeteur) )
{
header('Location: message-send.php?send=no');
}
elseif ( ereg('&lt;|<|url|link|http|wwww',$question) )
{
header('Location: message-send.php?send=no');
}
elseif (($name=="") || ($company=="") || ($email=="") || ($phone=="") || ($type=="") || ($question=="") )
{
header('Location: message-send.php?send=fieds');
}

else mail('contact@abcd.com','website contact',$message,$headers);
header('Location: message-send.php?send=ok');
?>

Two things,

One, check the error logs. Errors shouldn’t actually be seen in the browser by users.
the mail function is notoriously unreliable. I personally use a service, but using something like swift mailer or php mailer is also more usable than relying on the server having an smtp server running.

Checking the manual on ereg,

Warning
This function was DEPRECATED in PHP 5.3.0, and REMOVED in PHP 7.0.0.

Hi, thank you for your reply. Can you help me implement the swift mailer/php mailer? I can give you the address of the website in private message

Thank you for sharing this link. I am really a beginner so it is a little bit too much. Maybe I can share the link in a private message with you and you can tell what wrong. Like I said, It used to work perfectly. Let me know.

Sponsor our Newsletter | Privacy Policy | Terms of Service