formatting question

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
masada
Forum Newbie
Posts: 1
Joined: Thu Jun 15, 2006 7:03 pm

formatting question

Post by masada »

I've got this as a PHP page that a flash movie (contact form) is using to send to email:

Code: Select all

<?PHP 
$to = "myemailaddress@emailaccount.com"; 
$subject = "A message from your site"; 
$message = "Name: " . $theName; 
$message .= "\nEmail: " . $theEmail; 
$message .= "\nGuitar Model: " . $theModel; 
$message .= "\n\nMessage:\n " . $theMessage; 
$headers = "From: $theEmail"; 
$headers .= "\nReply-To: $theEmail"; 

mail($to,$subject,$message,$headers); 

?>

Works fine. But what I'd like to see is the text headers (Name, Email, etc.) that show up in the email to be bold with the imputed text normal. In other words, it would show up in the email as:

Name someone somename
Email something@somewhere.com
etc.

Everytime I drop a <b> </b> in the script it either shows up in the email or it breaks up my code. Any suggestions?
User avatar
blacksnday
Forum Contributor
Posts: 252
Joined: Sat Jul 30, 2005 6:11 am
Location: bfe Ohio :(

Post by blacksnday »

Send it as html:

Code: Select all

// To send HTML mail, the Content-type header must be set
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
reference page for above:
http://us2.php.net/manual/en/function.mail.php
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

If you look in the online PHP manual there is an example of sending a HTML email that you can use.
(#10850)
Post Reply