I have a script that requires a separate PHP file; that file defines the HTML table that is to be sent via e-mail. I put the table in a separate file to make it easy for any of the developers to open, understand and modify. The e-mail sends but it seems that it's not processing it correctly.
I have the following issues:
1.) The subject and from aren't set, instead both are set to "www-data".
2.) The HTML isn't parsed, instead the raw code is displayed.
Here's the PHP snippet of the submit.php
// Set some parameters
$toESN = "user@mydomain.com";
$fromESN = "otheruser@mydomain.com";
$subjectESN = "Status Notifcation";
$headersESN = "From: $fromESN" . "\r\n";
$headersESN .= "MIME-Version: 1.0" . "\r\n";
$headersESN .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
// Load the formatting
require("./send-esn.php");
if(!mail($toESN,$fromESN,$subjectESN,$bodyESN,$headersESN)){
echo "Error encountered";
}
and here's send-esn.php, with confidential information and table data removed of course.
// Generate the body
$bodyESN = "
<html>
<head>
<title></title>
</head>
<body>
<table border='0' cellspacing='0' cellpadding='0' width='600' style='font-family:arial,verdana; font-size: 12px;'>
</table>
</body>
</html>";