Page 1 of 1

problem with mail script

Posted: Sun Mar 28, 2004 8:33 pm
by John Cartwright
Okay I have my mail function which gathers the information and sends it

Code: Select all

<?php
mail ($to, $subject, "Name: $name\nE-mail: $email\nMessage: ".$_SESSION['message']." \n\nIP: $REMOTE_ADDR", "From: ".$_SESSION['email']."\n") or print "An unknown error occured.<br>";
?>
and this is where most of the information is put together:

Code: Select all

<?php
$feature =       array($logodesign,$bannerdesign,$graphicdesign,$shoppingcart, $interactivefeatures,$flashanimationandpresentation,
                       $webhosting,$domainnameregistration,$sitemaintenance, $editingandwritting,$merchantaccount,$customscripts,
					   $creditcardprocessing,$searchengineoptimization,$searchcapabilitiesonthewebsite,$databaseprogramming);

$message = 'Information about your project\n';
$message .= 'Type of site: '.$_SESSION['type'].'\n';		   
if ($type_other != ""){ 
$message .= 'Other: '.$_SESSION['type_other'].'\n'; 
} 
$message .= '<b>Features for the site: </b><br>';
foreach($feature as $feat){
if(isset($feat)){
$message .= '- '.$feat.'<br>';
}
} 
if (isset($features_other1)){
$message .= $features_other1.'<br>';
} 
$message .= '<b>Estimated Budget:</b> '.$_SESSION['budget'].'<br>';
$message .= '<b>Time until we can start project: </b>'.$_SESSION['time_start'].'<br>';
$message .= '<b>Time Frame: </b>'.$_SESSION['time_frame'].'<br>';
$message .= '<b>Overview: </b>'.$_SESSION['description'].'<br>'; 

echo "<br>";

echo "<table border="1" width="452" border="1" cellpadding="0" cellspacing="0" bordercolor="9A9A9A" align="center">\n".
     		"<tr class="porttext" bordercolor="EFEFEF" bgcolor="EFEFEF"><td width="5%"><td width="90%">\n";	 
echo "<br>".$message."<br>";
echo "<td width="5%">\n";
echo "</td></td></td></tr>\n";
echo "<tr bordercolor="EFEFEF" bgcolor="EFEFEF"><td><td><a class="conflink" href="?confirm=">Click here to confirm</a><br><td>&nbsp;</td>&nbsp;</td>&nbsp;</td></tr>\n";
echo "</table>\n";

$_SESSION['message'] = $message;
?>
The problem is all the html is being sent with it.... is there a way to strip the html out??

Posted: Sun Mar 28, 2004 8:37 pm
by Illusionist

Posted: Sun Mar 28, 2004 8:43 pm
by Steveo31
You need to have the email declared as HTML with this:

$headers = "MIME-Version: 1.0\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\n";

Posted: Sun Mar 28, 2004 8:46 pm
by John Cartwright
I'm confused.. wut do u eman steveo?



*edit*

I want to keep the tags but I need them to get formatted the way they should be... any ideas?

Posted: Sun Mar 28, 2004 10:35 pm
by Illusionist
Phenom wrote:I want to keep the tags but I need them to get formatted the way they should be... any ideas?
If i understand you correctly, then when you send the email it shows teh HTML tags, right? And you want the HTML to be activated right? If so then There isn't really much you can do about it. What Steveo suggested may work, but i know for a a fact that i can either choose to view my emails as either plain text or in HTML. So you don't have much control over that. But i may totaly be missing the point!

Posted: Sun Mar 28, 2004 10:39 pm
by d3ad1ysp0rk
uhh.. you can also change < and > to their symbol codes.. (using str_replace or whatever)

Posted: Sun Mar 28, 2004 10:46 pm
by Steveo31
Phenom wrote:I'm confused.. wut do u eman steveo?
*edit*
I want to keep the tags but I need them to get formatted the way they should be... any ideas?
In the mail() function, there are 4 parameters. to, subject, message, and headers. Have the headers part be the code I gave you. Like this:

Code: Select all

<?php
//variable declaration here //
mail($to, $subject, $message, $headers);

?>