Issue with a contact form


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.

//variable formulaire envoi

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

//corps message
<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' ''>
<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 {
<table width='650' border='0' align='center' cellpadding='0' cellspacing='0' bgcolor='#FFFFFF'>

<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>
<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 align='left'>
<td width='249'>". $company ."</td>
<td>". $phone ."</td>

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

if ( ereg('|||',$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('','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,

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