simon551 Posted August 28, 2007 Share Posted August 28, 2007 Hi, Can't figure out how to render html in an email. This is my php code. Below I will post how it comes in the email. I'm not sure why it's not generating the html as an html document. <?php //snip $to = $travelAdmin; $from_header = 'From: '.$email; $subject='Travel request from '.$traveler; //email contents follow $head='Travel Request'; $body= ' <html> <head> <title>Travel Request</title> </head> <body> <h3>General Information</h3> <h4>Traveler: '.$traveler.' <h4>Traveling for Project: '.$project.'</h4> <h3>Travel Details</h3> <h4> First Destination: '. $_SESSION['destination1'].'</h4>'. 'Departure Date: '. $_SESSION['departDate1'].'<br />'. 'Airfare Type: '. $_SESSION['airfareType3'].'<br />'. 'Arrival or Departure: '. $_SESSION['timeCriteria3'].'<br/ >'. 'First Time Option: '. $_SESSION['firstTime3'].'<br />'. 'Second Time Option: '. $_SESSION['secondTime3'].'<br />'. 'Third Time Option: '. $_SESSION['thirdTime3'].'<br />'; if (! ($_SESSION['destination2'])=='') { $body.= '<br /> <h4> Second Destination: '. $_SESSION['destination2'].'</h4>'. 'Departure Date: '. $_SESSION['departDate1'].'<br />'. 'Airfare Type: '. $_SESSION['airfareType2'].'<br />'. 'Arrival or Departure: '. $_SESSION['timeCriteria2'].'<br/ >'. 'First Time Option: '. $_SESSION['firstTime2'].'<br />'. 'Second Time Option: '. $_SESSION['secondTime2'].'<br />'. 'Third Time Option: '. $_SESSION['thirdTime2'].'<br />'; } if (! ($_SESSION['destination3'])=='') { $body.= '<br /> <h4> Third Destination: '. $_SESSION['destination3'].'</h4>'. 'Departure Date: '. $_SESSION['departDate1'].'<br />'. 'Airfare Type: '. $_SESSION['airfareType3'].'<br />'. 'Arrival or Departure: '. $_SESSION['timeCriteria3'].'<br/ >'. 'First Time Option: '. $_SESSION['firstTime3'].'<br />'. 'Second Time Option: '. $_SESSION['secondTime3'].'<br />'. 'Third Time Option: '. $_SESSION['thirdTime3'].'<br />'; } $car=$_SESSION['rentalCar']; if ($car=='') { $car='None'; } $body.= '<br /> <h4>Rental Car Requested: </h4>'.$car.'<br /> <h4>Special Requests: </h4>'.$_SESSION['specialRequests'].'<br /> </body> </html> '; $success = mail($to, $subject, $body, $from_header); This is the email received: <html> <head> <title>Travel Request</title> </head> <body> <h3>General Information</h3> <h4>Traveler: Lisa </h4> <h4>Traveling for Project: DMT | Blade S | 04/08/2000 | 04/14/2000 </h4> <h3>Travel Details</h3> <h4> First Destination: Los Angeles</h4>Departure Date: 08/27/07<br />Airfare Type: Coach<br />Arrival or Departure: <br/ >First Time Option: <br />Second Time Option: <br />Third Time Option: <br /><br /> <h4> Second Destination: PDX</h4>Departure Date: 08/27/07<br />Airfare Type: Business<br />Arrival or Departure: Arriving By<br/ >First Time Option: 06:00 AM - 08:00 AM<br />Second Time Option: 07:00 AM - 08:00 AM<br />Third Time Option: <br /><br /> <h4>Rental Car Requested: </h4>compact<br /> <h4>Special Requests: </h4>Please pick me up at home Jeri<br /> </body> </html> Is there something else I need to do to tell the email program that this is an html email document? Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted August 28, 2007 Share Posted August 28, 2007 can't see any headers to let the client know you are sending html email! quick search found this (haven't read it personnally but it may help) http://www.webcheatsheet.com/php/send_email_text_html_attachment.php Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.