I am using the following code which is being sent over SMTP. When email message is received in gmail raw html appears. In Outlook the message is blank. What is the issue? A php error or server problem?
(process-form.php)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style>
body {
background-color: #6BBDB9;
}
div {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
}
div.mailbody {
font-family: "Courier New", Courier, mono;
}
div.mailfail {
width: 450px;
border: 3px solid #000000;
padding: 22px 22px 22px 22px;
text-align: center;
vertical-align: middle;
background-color: #FEBA3B;
color: #3F2401;
font-weight: bold;
}
div.mailsent {
width: 450px;
border: 3px solid #000000;
padding: 22px 22px 22px 22px;
text-align: center;
vertical-align: middle;
background-color: #FF900B;
color: #000000;
font-weight: bold;
}
</style>
<title><?php echo($title); ?></title>
<?php
require ("smtpclass.php");
if($_SERVER["REQUEST_METHOD"] == "POST")
{
$smtp=new SMTPMAIL;
$stemail = "test@gmail.com"; //EMAIL TO RECIEVE THE PRESENTATION BOOKINGS
$stsubject = "Contact from Website"; //THE SUBJECT OF THE EMAIL
$stfrom = "do-not-send@website.com"; //THE 'From:' EMAIL ADDRESS
$stwho= "website"; //NAME TO APPEAR ON THE EMAIL
$streply= "do-no-reply@website.com"; //THE REPLY-TO ADDRESS
$cc="";
if(!$_POST['fullname']) {
header("Location: index.html");
}
$headers = "From: " .$stwho. "<".$stfrom. ">\n" . "Reply-To: " .$streply. "\n";
$headers .= 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// message
$message = "";
$artype = array(
"keynote" => "Keynote Address",
"seminar" => "Seminar",
"workforce" => "Workforce Development",
"training" => "Leadership / Staff Training"
);
$arevent = array(
"forum" => "Forum",
"formal" => "Formal Address",
"informal" => "Informal Address - Audience Interaction",
"discussion" => "Discussion",
"solving" => "Problem Solving"
);
$audtype = "";
if($POST['professional']) { $audtype.="Professional"; }
if($POST['management']) { $audtype.="Management"; }
if($POST['employees']) { $audtype.="Employees"; }
if($POST['youth']) { $audtype.="Youth"; }
$audgend = "";
if($POST['male']) { $audgend.="Male"; }
if($POST['female']) { $audgend.="Female"; }
if($POST['coed']) { $audgend = "Co-ed"; }
$ftimeframe = "Multi Day";
if($POST['timeframe'] == 'single') {
$ftimeframe = "Single Day";
}
$fotherspeakers = "None";
if($POST['otherspeakers'] == 'yes') {
$fotherspeakers = strip_tags($POST['whospeakers']);
}
$avequip = "None";
if($POST['equip'] == 'yes') {
$avequip = strip_tags($POST['yesequip']);
}
$artopics = array(
"book" => "The book",
"leadership" => "Leadership & Management",
"communication" => "Communication",
"planning" => "Planning",
"skills" => "Presentation Skills",
"contracts" => "Government Contracts"
);
$message .= "<html><body>";
$message .= "\n<table rules=\"all\" style=\"border-color: #666;\" cellpadding=\"10\" width=\"100%\">";
$message .= "\n<tr style='background: #eee;'><td width='30%'><strong>Name:</strong> </td><td width='70%'>" . strip_tags($POST['fullname']) . "</td></tr>";
$message .= "\n<tr style='background: #eee;'><td><strong>Phone:</strong> </td><td>" . strip_tags($POST['phone']) . "</td></tr>";
$message .= "\n<tr style='background: #eee;'><td><strong>Email:</strong> </td><td>" . strip_tags($POST['email']) . "</td></tr>";
$message .= "\n<tr style='background: #eee;'><td><strong>Organization:</strong> </td><td>" . strip_tags($POST['organization']) . "</td></tr>";
$message .= "\n<tr style='background: #eee;'><td><strong>Address:</strong> </td><td>" . strip_tags($POST['address']) . "</td></tr>";
$message .= "\n<tr style='background: #eee;'><td><strong>Type of Presentation:</strong> </td><td>";
if($POST['type'] == "other") {
$message .= strip_tags($POST['typeother']) . "</td></tr>";
} else {
$message .= $artype[$POST['type']] . "</td></tr>";
}
$message .= "\n<tr style='background: #eee;'><td><strong>Type of Event:</strong> </td><td>" . $arevent[$POST['event']] . "</td></tr>";
$message .= "\n<tr style='background: #eee;'><td><strong>Audience Type:</strong> </td><td><ul>" . $audtype . "</ul></td></tr>";
if($POST['youth']) {
$message .= "\n<tr style='background: #eee;'><td><strong>Youth Age Group:</strong> </td><td>" . strip_tags($POST['youthother']) . "</td></tr>";
}
$message .= "\n<tr style='background: #eee;'><td><strong>Audience Gender:</strong> </td><td><ul>" . $audgend . "</ul></td></tr>";
$message .= "\n<tr style='background: #eee;'><td><strong>Event Time Frame:</strong> </td><td>" . $ftimeframe . "</td></tr>";
if($POST['timeframe'] == 'multi') {
$message .= "\n<tr style='background: #eee;'><td><strong>Days:</strong> </td><td>" . strip_tags($POST['multidays']) . "</td></tr>";
}
$message .= "\n<tr style='background: #eee;'><td><strong>Other Speakers:</strong> </td><td>" . $fotherspeakers . "</td></tr>";
if($fotherspeakers != 'None') {
$message .= "\n<tr style='background: #eee;'><td><strong>Speakers Topics:</strong> </td><td>" . strip_tags($POST['speakerstopics']) . "</td></tr>";
}
$message .= "\n<tr style='background: #eee;'><td><strong>A/V Equipment:</strong> </td><td>" . $avequip . "</td></tr>";
$message .= "\n<tr style='background: #eee;'><td><strong>Desired Topics:</strong> </td><td>";
if($POST['topics'] == "other") {
$message .= strip_tags($POST['topicsother']) . "</td></tr>";
} else {
$message .= $artopics[$_POST['topics']] . "</td></tr>";
}
$message .= "\n</table>";
$message .= "\n</body></html>";
if(!$smtp->send_smtp_mail($stemail,$stsubject,$message,$headers,$cc,$stfrom))
$error="Error in sending the following message please directly email contact@website.com: ".$smtp->error;
else
$report="The following message was sent successfully!";
}
?>
<?php @extract($_POST);?>
</head>
<body>
<center><div class="mailsent"><?php echo $report; echo $error; ?>:<br /><br />
<div class="mailbody"><?php echo($message); ?></div><br /><br />
<a href="javascript:history.go(-1);">Go Back</a>
</div></center>
</body>
</html>