Below is the code for my booking form email, sent from a Linux server:
$body = "
<p>Hello sir,</p>
<p>Name: <b> {$firstname}</b><br />
Email: <b> {$email}</b><br />
Phone: <b> {$phone}</b><br />
Length Of Stay: <b> {$length} </b><br />
Number in Party: <b> {$party} </b><br />
Month : <b> {$month} </b><br />
Day: <b> {$day} </b><br />
Year: <b> {$year} </b><br />
Additional information:<b> {$additional_information} </b>
</p>
<p>with best regards, <br /><b>My Website</b></p>
";
$to = 'info@currentwebsite.com';
$subject = 'Message';
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: '. $email. "\r\n";
$headers .= 'Reply-To: '.$email.'' . "\r\n" ;
if(mail($to, $subject, $body, $headers))
{
phpalert( 'Your request has been sent successfully!' );
}
else {
phpalert( 'Sorry! could not send your request. Please try again later.' );
}
Does anyone know why my mail is not coming? It shows “Your request has been sent successfully!” But I can’t find any email in inbox or even in spam.
Added
Is there any chances of blocking mails from server?
try sending a simple mail without any meta, headers, mime etc first ! try out the php documentation examples first. I they dont work, you have a server problem (php module deactivated or something like that):
http://php.net/manual/en/function.mail.php