Page 1 of 1

HTML Email Script

Posted: Thu Jul 21, 2005 3:43 pm
by cdog12
Hi there everyone, I have been having some problems with this particular email script. I am running another email script that is very similar to this one but for some reason it doesn't work. Can someone who knows more about this than me have a look at it and see if there are any obvious flaws? Thanks alot.

Code: Select all

<?php 
$event = $_POST['event']; 
$eventDate = $_POST['eventDate']; 
$room = $_POST['room'];
$name = $_POST['name']; 
$phone = $_POST['phone']; 
$email = $_POST['email'];
if (isset($_POST['microphone'])) {$microphones = 'checked=checked';} else {$microphones = ''; };
if (isset($_POST['soundsystem'])) {$soundsystem = 'checked=checked';}else {$soundsystems = '';};
$soundApproval = $_POST['soundApproval'];
if (isset($_POST['podium'])) {$podium = 'checked=checked';} else {$podium = ''; };
$trashCans = $_POST['trashCans'];
$blueCloth = $_POST['blueCloth'];
$bluePlastic = $_POST['bluePlastic'];
$childChairs = $_POST['childChairs'];
$cafTables = $_POST['cafTables'];
$roundTables = $_POST['roundTables'];
$classTables = $_POST['classTables'];
$rectangleTables = $_POST['rectangleTables'];
$tablesApproval = $_POST['tablesApproval'];
$coffeeUrn = $_POST['coffeeUrn'];
$waterUrn = $_POST['waterUrn'];
$whiteCarafe = $_POST['whiteCarafe'];
$goldCarafe = $_POST['goldCarafe'];
$pitcher = $_POST['pitcher'];
$orangeCooler = $_POST['orangeCooler'];
$smallBowl = $_POST['smallBowl'];
$largeBowl = $_POST['largeBowl'];
$largeRoundTray = $_POST['largeRoundTray'];
$largeBlackTray = $_POST['largeBlackTray'];
$LargeRectangleTray = $_POST['LargeRectangleTray'];
$otherTray = $_POST['otherTray'];
$clothTablecloth = $_POST['clothTablecloth'];
$plasticTablecloth = $_POST['plasticTablecloth'];
$utensils = $_POST['utensils'];
$kitchenApproval = $_POST['kitchenApproval'];
$notes = $_POST['notes'];

$notes = stripcslashes($notes);
?> 

<?php
$to = 'chrismack@gmail.com';
$subject = 'Building Use Form';
$headers = "From: $name <$email>" . '\r\n';
$headers .= 'MIME-Verion: 1.0' . '\r\n';
$headers .= 'Content-type: text/html; charset=iso-8859-1' . '\r\n';

$message = "
<html>
<head>
<title>Equipment Use Form</title>
<style type='text/css'>
<!--
.style1 {
	font-family: Arial, Helvetica, sans-serif;
	color: #000000;
}
.font {
	font-family: Georgia, 'Times New Roman', Times, serif;
	font-size: 12pt;
	font-variant: normal;
	color: #000000;
}
.style3 {font-size: x-small}
p, h2, h4 {
	margin: 2px;
	padding: 2px;
}
h4 {
	text-decoration: underline;
}
-->
</style>
</head>
<body>
<span class='font'>
<h2>Providence Building Use Form</h2>
<p>&nbsp; </p>
Name of Event: <strong>$event</strong> <br />
Date of Event: <strong>$eventDate</strong>
 Room #: <strong>$room </strong><br />
Name of Contact: <strong>$name </strong>
Phone #: <strong>$phone</strong>
Your Email: <strong>$email</strong>
</span><span><br /> 
<br />
</span>
<table width='600' cellpadding='0' cellspacing='0'>
  <tr>
    <td width='247' valign='top' class='font'><h4 align='center'><strong> Worship/Sound Equip. </strong></h4>
        <p align='center' class='style3'> *please return all equipment to designated locked storage. </p>
        <p> 
          <input name='microphones' type='checkbox' id='microphones' value='yes' /> 
        Microphones </p>
        <p> 
          <input name='soundsystem' type='checkbox' id='soundsystem' value='yes' /> 
        Sound System </p>
        <p> Approval: <strong>$soundApproval</strong>
        </p>
        <p align='center'><em>(JMAW or Dave Garcia) </em></p>
        <p align='center'><em> &nbsp;</em></p>
        <h4 align='center'><strong> Tables / Chairs </strong></h4>
        <p align='center' class='style3'> *contact person responsible for set up, please return furniture to original location</p>
        <p> 
          $podium&mdash;podium </p>
        <p> 
          $trashCans&mdash;trash cans/liners </p>
        <p> 
          $blueCloth&mdash;blue cloth chairs (400) </p>
        <p> 
         $bluePlastic&mdash;blue plastic (200) </p>
        <p> 
          $childChairs&mdash;children’s chairs (50) </p>
        <p> 
          $cafTables&mdash;cafeteria tables (12) </p>
        <p> 
          $roundTables&mdash;round tables (12) </p>
        <p> 
          $classTables&mdash;thin classroom tables (30) </p>
        <p> 
          $rectangleTables&mdash;rectangle tables (5) </p>
        <p> Approval: <strong>$tablesApproval</strong> 
        </p>
      <p align='center'><em>(Nic Muniz, Coordinator) </em></p></td>
    <td width='356' valign='top' class='font'><h4 align='center'><strong> Kitchen </strong></h4>
        <p align='center'> <span class='style3'>*please return all equipment to locked closets in kitchen right after event. </span></p>
        <p align='center'><span class='style3'> *please indicate # needed</span> </p>
        <p> 
          $coffeeUrn&mdash;100 cup coffee urn (2) </p>
        <p> 
          $waterUrn&mdash;100 cup hot water urn (1) </p>
        <p> 
          $whiteCarafe&mdash;white Hot water Carafes (20) </p>
        <p> 
          $goldCarafe&mdash;Gold & Black Coffee Carafes (3) </p>
        <p> 
          $pitcher&mdash;plastic water pitchers (8) </p>
        <p> 
          $orangeCooler&mdash;large orange drink coolers (2) </p>
        <p> 
          $smallBowl&mdash;small bowls (4) </p>
        <p> 
          $largeBowl&mdash;large bowls (5) </p>
        <p> 
          $largeRoundTray&mdash;large round clear trays (5) </p>
        <p> 
          $largeBlackTray&mdash;large black trays (2) </p>
        <p> 
          $LargeRectangleTray&mdash;large rectangle clear trays (5) </p>
        <p> 
          $otherTray&mdash;other trays</p>
        <p> 
          $clothTablecloth&mdash;cloth tablecloths </p>
        <p> (please launder & return on hanger within 24 hr.) </p>
        <p>&nbsp; </p>
        <p> 
          $plasticTablecloth&mdash;plastic tablecloths </p>
        <p> (please wipe off, replace if needed) </p>
        <p>&nbsp; </p>
        <p> 
          $utensils&mdash;utensils (knives, spatulas, serving spoons) </p>
        <p> Approval: $kitchenApproval  
        </p>
      <p><em> (Rolinda Marcum, Coordinator)</em></p></td>
  </tr>
  <tr>
    <td colspan='2' valign='top' class='font'>Notes:<br />
      $notes
    </tr>
</table>

</body>
</html>



";

$message = wordwrap($message, 70);
mail($to, $subject, $message, $headers);
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<title>Your Email Has Been Sent</title>
</head>
<body>
Congratulations Your Request has been submitted.
<br /><br />
<a href="equipmentUse.php"> Go Back</a>
</body>
</html>

Posted: Thu Jul 21, 2005 3:45 pm
by Burrito
what isn't working with it? it's tough to help you fix something when we dont' know what isn't working...

Posted: Thu Jul 21, 2005 3:53 pm
by ol4pr0
Indeed what isnt working. Besides that i dont think your variables are being included in your mail like that.

Code: Select all

# According to me it should be something like this
$message = "<html><head><title>MAIL</title></head><body>Hello this ".$coffeeUrn." / 100</body></html>";

Posted: Thu Jul 21, 2005 6:44 pm
by bokehman
'checked=checked' this is wrong! Should be checked="checked"

Posted: Fri Jul 22, 2005 4:53 am
by s.dot
first off
print your variables to see if they are indeed set correctly.

Code: Select all

echo $to;
echo $subject;
echo $message;
echo $header;
then use an if to see if your mail is being sent

Code: Select all

if(mail()){ echo "success" } ELSE { echo "failur"; }
This will help you see if your mail has the proper syntax and variables to be sent.

If that's not the problem, perhaps your mail program doesn't accept HTML emails.