Reputation: 571
I've written the following PHP script to send an email based on a forms input:
<?php
$to=$_POST["email"];
$subject=$_POST["subject"];
$message=$_POST["message"]."<br />".'<img src=imgdir/'.$_POST["banimg"].'"/><br /><br />'.'<img src=addir/'.$_POST["adimg"].'"/><br /><br />';
$from="[email protected]";
$headers=array();
$headers[]="MIME-Version: 1.0";
$headers[]="Content-type: text/html; charset=iso-8859-1";
$headers[]="Content-Transfer-Encoding: 8bit";
$headers[]="From: ".$from;
$advertised=mail($to,$subject,$message,join("\n",$headers));
if ($advertised){
echo "Working";
}
?>
My echo "Working" returns as true, so the script is completing, however, the email is not being delivered.
Is there an issue within my code here?
Dustin
Upvotes: 0
Views: 895
Reputation: 69977
The php manual states that Multiple extra headers should be separated with a CRLF (\r\n).
It is possible that is a source of the problem. Aside from that, make sure that your email settings in php.ini are configured properly for the local server, and that a mta such as sendmail or smtp is installed and running on the server.
Upvotes: 1