Trying to send an HTML email through sendmail...having some

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
aredden
Forum Commoner
Posts: 29
Joined: Fri May 25, 2007 7:10 am

Trying to send an HTML email through sendmail...having some

Post by aredden »

Ok, so im trying to do an html emailer. but im having some issues and I don't know where to begin.

getting a

Parse error: parse error, unexpected T_STRING in /home/content/f/m/a/fmafadmin/html/Response/mailout.php on line 70

But i cant figure out how to fix the issue.

Code: Select all

<?php
session_start();

$id4 = $_SESSION['id2'];

$con = mysql_connect("****","****","*****");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("****", $con);

$result = mysql_query("SELECT * FROM main2 WHERE main2.id = $id4") or die(mysql_error());

$row = mysql_fetch_array($result);

mysql_close($con);

$opt1 = $_SESSION['opt1'];
$opt2 = $_SESSION['opt2'];

$to = $row['email'];
$subject = "Your Requested Fare Information";

mail($to, $subject,
    '<!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=utf-8"/>
<title>FindMeAFare.com - Get A Quote</title>
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon"/>
<link rel="stylesheet" type="text/css" href="http://www.findmeafare.com/fmaf.css"/>
<style type="text/css">
<!--
.style2 {
	color: #000000;
	font: Verdana;
}
.style3 {color: #FF0000}
body {
	background-color: #666;
}
.style5 {color: #000000}
-->
</style>
</head>
<body>

<div id="container">

<div id="banner">
<div id="dashed">

<h1 class="stylebanner">FindMeAFare.com</h1>
<h2> - Quick, Simple, Reliable</h2>
</div>
<div align="right"></div>
</div>


<div class="style2" id="main">

<form id="form1" method="post" action="">
  <div class="style2" id="main2">
    <h3 align="left">Greetings, </h3>
    <p align="left">Please be advised you have 48 hours before your fare expires, if it is not ticketed within that timeframe the quoted price will be lost. Thanks</p>
    <p>Option 1:</p>
    <p> Your Fare is:
      <input name="textfield" type="text" id="textfield" value="<?php echo $row['farequote']; ?>" />
      , with a Fare basis of 
       <input name="textfield2" type="text" id="textfield2" value="<?php echo $row['fbasis']; ?>" />
      <br />
      <br />
      <textarea name="textarea" id="textarea" cols="45" rows="5"><?php 
echo('$opt1');
 ?>
      </textarea>
      <br />
      Option 2:</p>
    <p> Your Fare is: 
      <input name="textfield3" type="text" id="textfield3" value="<?php echo $row['fquote2']; ?>" />
      ,
      with a Fare basis of 
      <input name="textfield4" type="text" id="textfield4" value="<?php echo $row['fbasis2']; ?>" />
      <br />
      <textarea name="textarea2" id="textarea2" cols="45" rows="5"><?php 
echo('$opt2');
 ?>
      </textarea>
      <br />
    </p>
    <p>What you requested!</p>
    <table width="481" border="0" cellpadding="0">
      <tr>
        <td>Traveling From:</td>
        <td colspan="3"><?php echo $row['deptcity']; ?></td>
        </tr>
      <tr>
        <td>Traveling To:</td>
        <td colspan="3"><?php echo $row['arrivalcity']; ?></td>
        </tr>
      <tr>
        <td>Departing Date:</td>
        <td colspan="3"><?php echo $row['deptdate']; ?></td>
        </tr>
      <tr>
        <td>Returning Date:</td>
        <td colspan="3"><?php echo $row['retdate']; ?></td>
        </tr>
      <tr>
        <td>Passenger 1:</td>
        <td><?php echo $row['pass1name']; ?></td>
        <td><?php echo $row['pass1age']l; ?></td>
        <td><?php echo $row['pass1nation']; ?></td>
      </tr>
      <tr>
        <td>Passenger 2:</td>
        <td><?php echo $row['pass2name']; ?></td>
        <td><?php echo $row['pass2age']; ?></td>
        <td><?php echo $row['pass2nation']; ?></td>
      </tr>
      <tr>
        <td>Passenger 3:</td>
        <td><?php echo $row['pass3name']; ?></td>
        <td><?php echo $row['pass3age']; ?></td>
        <td><?php echo $row['pass3nation']; ?></td>
      </tr>
      <tr>
        <td>Passenger 4:</td>
        <td><?php echo $row['pass4name']; ?></td>
        <td><?php echo $row['pass4age']; ?></td>
        <td><?php echo $row['pass4nation']; ?></td>
      </tr>
    </table>
    </div>
</form>
</div>


<div class="style3" id="sideBar">

<img src="http://www.findmeafare.com/img/Burj Al Arab.jpg" alt="Burj Al Arab 7 Star Hotel - Dubai" width="150" height="200" />

<ul id="navBar">
<li><a href="index.php">&raquo; Home/News</a></li>
<li><a href="services.php">&raquo; Services</a></li>
<li><a href="whatshot.php">&raquo; Hottest Travel Spots</a></li>
<li><a href="#">&raquo; Get A Quote</a></li>
<li><a href="travel.php">&raquo; Travel Advisories</a></li>
<li><a href="contactus.php">&raquo; Contact Us</a></li>
<li id="noLine"><a href="agency.php">&raquo; Approved Agencies</a></li>
</ul>

<div id="box"></p>
  <p><img src="http://www.findmeafare.com/img/big ben.jpg" alt="" width="135" height="225" border="0" align="absmiddle" /></p>
</div>
</div>

<div id="clear"></div>
</div>

<div id="bottom"></div>

<div class="style5" id="copy">&copy; 2007 FindMeAFare.com</div>
</body>
</html>',
    "To: The Receiver <recipient@some.net>\n" .
    "From: The Sender <sender@some.net>\n" .
    "MIME-Version: 1.0\n" .
    "Content-type: text/html; charset=iso-8859-1"); 



echo('<a href="index.php">Click to return</a>');
?>
User avatar
Chalks
Forum Contributor
Posts: 447
Joined: Thu Jul 12, 2007 7:55 am
Location: Indiana

Post by Chalks »

I'm guessing your problem is right here:

Code: Select all

<td><?php echo $row['pass1age']l; ?></td>
What's that l doing there?
aredden
Forum Commoner
Posts: 29
Joined: Fri May 25, 2007 7:10 am

Post by aredden »

thats just a typo, but the issue is on line 70, not that line.
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

aredden wrote:thats just a typo, but the issue is on line 70, not that line.
Line 70 is likely a typo as well. We're not going to count each line to find it, you'll need to tell us which it is.
And if you look at the highlighter, you've got some horrible syntax errors.
User avatar
Chalks
Forum Contributor
Posts: 447
Joined: Thu Jul 12, 2007 7:55 am
Location: Indiana

Post by Chalks »

in general, superdezign is right. We're not going to count code. Lucky for you though... I'm bored out of my mind and had nothing better to do. :D

Here's your problem:

Code: Select all

<input name="textfield" type="text" id="textfield" value="<?php echo $row['farequote']; ?>" />
Why? Because you have php tags within php tags... it doesn't make sense. I would change it to this:

Code: Select all

$message = "all that stuff and when you come to a row variable do this " . $row['farequote'] . " continue message.";
mail($to, $subject, $message);
I think that will fix your problem. Again, back to what superdezign said... there are some syntax errors in there. Read through your code, and make sure everything fits together right, and try to remove all typos.
aredden
Forum Commoner
Posts: 29
Joined: Fri May 25, 2007 7:10 am

Post by aredden »

ok thanks for the reply, and i suppose i should have proof read, but was in a hurry. :P

the reason i have that is im trying to send it as an html email, and I want to display my value inside of the text field. i shall give it a try without the <?php brackets tho
Post Reply