I'm back! After getting sidetracked to other projects (which happens often), I'm back to our online job application. I'm still wrestling with my original question.
See, what you're getting hung up on is "html file". You're not wanting an HTML file, you just want HTML.
Actually, no. I want an html file. It currently sends perfectly fine as an HTML email. In Thunderbird, it looks fantastic. Unfortunately, our HR department uses Outlook 2007, which hammers the code (to put it mildly). Regardless, the job application needs to look and print the same from everyone's computer, regardless of email client. I wrote (but haven't yet tested) a method wherein I create a file (fopen) using the data from the form, save it to the server, then attach the newly created file to the email I'm trying to send. This seems like an incredibly hokey work-around.
So, the question is: Is it possible to simply (and immediately) send this info as an attachment rather than (or in addition to) a standard email.
Here is my (truncated) code as it exists:
<?php
$today = date("j F Y");
$name = check_input ($_POST['name']);
$telephone = check_input ($_POST['telephone']);
$email = check_input ($_POST['email']);
$address = check_input ($_POST['address']);
$city = check_input ($_POST['city']);
$state = check_input ($_POST['state']);
$zip = check_input ($_POST['zip']);
...
//Message Content
$to = 'easmith@example.com>';
$subject = 'Job Application';
$message = "
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1' />
<title>Application</title>
<style type='text/css'>
body {
font-family: Georgia, 'Times New Roman', Times, serif;
border: 0;
margin: 0;
padding: 0;
}
...
</style>
</head>
<body>
<div id='pagewrap'>
<fieldset id='personal_data'><legend>Employment Application v3.09</legend>
<p class='name'>$name</p>
<div id='main-address'>
<p id='main-phone'>$telephone</p>
<p><a href='mailto:$email'>$email</a></p>
<p>$address</p>
<p>$city, $state $zip</p>
</div>
</fieldset>
...
</body>
</html>
";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: ' . $name . ' <' . $email . '>' . "\r\n";
$mail = mail($to, $subject, $message, $headers);
if ($mail) {
echo "
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1' />
<title>Employment Application</title>
<link href='application.css' rel='stylesheet' type='text/css' />
</head>
<body>
<table width='100%' border='0' cellspacing='0' cellpadding='0'>
<tr>
<td align='left' valign='top'> </td>
<td class='main'><h1>THANK YOU</h1>
<p>Thank you for your interest. Your application will receive consideration without regard to race, creed, color, sex, age, national origin or disability.</p>
</td>
<td valign='top'>
</td>
</tr>
</table>
</body>
</html>
";
} else {
echo "no dice";
}
function check_input($data)
{
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
?>
Would it be against forum policy to offer a free pizza to anyone who can solve this for me? Probably.