Jump to content

[SOLVED] html email


simon551

Recommended Posts

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?

 

Link to comment
https://forums.phpfreaks.com/topic/66957-solved-html-email/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.