I have a website hosted with hostmonster. I have a simple subscribe form which sends an email to my email account to notify me when someone subscribes. The code is below:
//SEND EMAIL START --------------------------------------------
$to = '***@***.com';
// subject
$subject = 'Subscriber';
// message
$message = '
<html>
<head>
<title>Subscriber</title>
</head>
<body>
<p style="font-size:x-large;text-align:center">Subscriber</p>
<p>A person has subscribed to www.***.com.</p>
<p><strong>Name:</strong> ' . $name . '</p>
<p><strong>Email:</strong> ' . $email . '</p>
<p></p>
<p style="font-size:x-small;text-align:center">Email sent from ***@***.com.<br>
</body>
</html>
';
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: NAME <***@***.com>' . "\r\n";
$headers .= 'Reply-To: NAME <***@***.com>' . "\r\n";
$headers .= 'X-Mailer: PHP/' . phpversion() . "\r\n";
$eLog="tmp/mailError.log";
//Get the size of the error log, ensure it exists, create it if it doesn't.
$fh = fopen($eLog, "a+");
fclose($fh);
$originalsize = filesize($eLog);
@mail($to,$subject,$message,$headers);
clearstatcache();
$finalsize = filesize($eLog);
if ($originalsize != $finalsize) {
print "Problem sending mail. (size was $originalsize, now $finalsize) See $eLog";
}
//SEND EMAIL END --------------------------------------------
I have copied this file and created another file where you can unsubscribe. Exactly the same code. The unsubscribe file does not send the email to me but the subscribe does.
What have I done wrong? I am confused. There are no errors that I can see. The log file says:
mail() on [/home2/***/public_html/***/subscribe.php:80]: To: ***@***.com -- Headers: MIME-Version: 1.0 Content-type: text/html; charset=iso-8859-1 From: *** <***@***.com> Reply-To: *** <***@***.com> X-Mailer: PHP/5.4.43
mail() on [/home2/***/public_html/***/unsubscribe.php:78]: To: ***@***.com -- Headers: MIME-Version: 1.0 Content-type: text/html; charset=iso-8859-1 From: *** <***@***.com> Reply-To: *** <***@***.com> X-Mailer: PHP/5.4.43