Help with a problem?

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

Locked
darkfreaks
Forum Commoner
Posts: 59
Joined: Sat Sep 09, 2006 3:59 pm

Help with a problem?

Post by darkfreaks »

hey,

i have a problem with my email contact form i want the message im sending which is in html to show as html but when it sends it shows as plain text and you can see alll the html tags :(


any fixes to this problem?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Set the content type to text/html in the headers.
darkfreaks
Forum Commoner
Posts: 59
Joined: Sat Sep 09, 2006 3:59 pm

Post by darkfreaks »

this is the email i get after i put the headers in but it still shows html tags when sent

:

Code: Select all


[syntax=php]order fromBryceMIME-Version: 1.0Content-Type: multipart/alternative; boundary = HTMLDEMO457c77a08d011 This is a MIME encoded message. --HTMLDEMO457c77a08d011Content-Type: text/html; charset=ISO-8859-1Content-Transfer-Encoding: base64 VGhpcyB0aGUgPGI+SFRNTDwvYj4gdmVyc2lvbiE=  <b><center><font face="arial" size="3" color="white">Bryce has ordered the following items:</center>   <center><table border="1" bordercolor="white"> <tr><td>Necklace:</td><td> Length</td><td> Pattern</td><td> Bead Color</td><td> Bead Size</td><td> Chain Size</td><td>Bead Type</td><td>Quantity</td><td>Subtotal:</td></tr> <tr><td>Necklace of the Night Sky:</td><td>6</td><td>bead</td<td>Red</td><td>6mm</td><td>Large</td><td>Glass</td><td> 4 </td><td>$200</tr> <tr><td>Chainmaile Beaded FancyNecklace:</td><td>20</td><td>bead</td><td>Red</td><td>6mm</td><td>Large</td><td>Glass</td><td>11</td><td>$550</td></tr> <tr><td>Antique Key Necklace:</td><td></td><td>bead</td><td>Red</td><td>6mm</td><td>Large</td><td>Glass</td><td>12</td><td>$360</td></tr> <tr><td>Chainmaile Fancy Necklace:</td><td>24</td><td>bead</td><td>Red</td><td>6mm</td><td>Large</td><td>Glass</td><td>12</td><td>$600</td></tr> <tr><td>Chainmaile V Necklace:</td><td>25</td><td>bead</td><td>Red</td><td>6mm</td><td>Large</td><td>Glass</td><td>19</td><td>$950</td></tr> <tr><td colspan="9"><hr></td></tr><tr><td>Total:</td><td></td><td></td><td></td><td></td><td></td><td>58</td><td>$2660</td></tr> </font></table></center>
[/syntax]
darkfreaks
Forum Commoner
Posts: 59
Joined: Sat Sep 09, 2006 3:59 pm

Post by darkfreaks »

also Order from: (name here) is suposed to show in the subject not the message and now the subject has become nobody@ localserver.com ???
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

what does the header look like you're sending to identify it as HTML.

it should be something like this:

Content-Type: text/html;
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

What code did you use?
darkfreaks
Forum Commoner
Posts: 59
Joined: Sat Sep 09, 2006 3:59 pm

Post by darkfreaks »

Code: Select all

[syntax=php]//specify MIME version 1.0 
$headers .= "MIME-Version: 1.0\r\n"; 

//unique boundary 
$boundary = uniqid("HTMLDEMO"); 

//tell e-mail client this e-mail contains//alternate versions 
$headers .= "Content-Type: multipart/alternative" . 
   "; boundary = $boundary\r\n\r\n"; 

//message to people with clients who don't 
//understand MIME 
$headers .= "This is a MIME encoded message.\r\n\r\n"; 


//HTML version of message
$headers .= "--$boundary\r\n" . 
   "Content-Type: text/html; charset=ISO-8859-1\r\n" . 
   "Content-Transfer-Encoding: base64\r\n\r\n"; 
$headers .= chunk_split(base64_encode("This the <b>HTML</b> version!"));
[/syntax]

please tell me if there is anything wrong with this code or needs ot be changed in anyway so it actually works. :wink:
darkfreaks
Forum Commoner
Posts: 59
Joined: Sat Sep 09, 2006 3:59 pm

Post by darkfreaks »

please lock this topic i got the headers to work correctly :D
Locked