acidglitter Posted September 22, 2006 Share Posted September 22, 2006 You know the mail() function? I'm using it like this...mail("email", "subject","$crazy","From: me <email\n");$crazy = all these html things.. But when I get the message, it puts things like (b) instead of actually being bold.. How can I make it show up right instead of showing the code?? Quote Link to comment Share on other sites More sharing options...
honeyboy_20 Posted September 22, 2006 Share Posted September 22, 2006 [code]<?php// email address here$to= "email@example.com";// The subject$subject = "Enter your subject here";// The message$message = "<b>Enter your message here</b><br>";$from="your_email_here@test.com";mail($to, $subject, $message, "From: $from");?>[/code] Quote Link to comment Share on other sites More sharing options...
acidglitter Posted September 22, 2006 Author Share Posted September 22, 2006 I meant like the message.. Everything sends alright but when I get the email it shows the codes in $crazy Quote Link to comment Share on other sites More sharing options...
redarrow Posted September 23, 2006 Share Posted September 23, 2006 Use the code i have provided you have to set the headers to get the mail to send proper html formated text ok.[code]<?php$to = 'nobody@example.com';$subject = 'the subject';$message = '<b>put you code here ok</b>';$headers = 'X-Mailer: PHP/' . phpversion();mail($to, $subject, $message, $headers);?> [/code] Quote Link to comment Share on other sites More sharing options...
tomfmason Posted September 23, 2006 Share Posted September 23, 2006 If you are going to send html in the email then you might want to use something like this. [code]<?php$to = "someone@something.com";$subject = "Something";$message = "<html><head><title>Something</title></head><body><table width="600"> <tr> <td>You can put something<b>here</b></td> </tr></table></body></html>";$knownsender = "you@yoursite.com";//make sure that this an email address that is known to the server$headers = "FROM: $knownsender\r\n";$headers .= "MIME-Version: 1.0\r\n";$headers .= "Content-type: multipart/alternative;\r\n";$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";$headers .= "Content-Transfer-Encoding: 7bit";$headers .= "\r\n";if (mail($to, $subject, $message, $headers)) { echo "Your mail was sent to $to";}else{ echo "Unable to send the message";} ?>[/code]Also, it is important to rember that you should keep the width of your tables to no more then 600.Good Luck,Tom Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.