Syrehn Posted January 4, 2010 Share Posted January 4, 2010 Hi all, I was just wondering is there a way to make part of the data being posted by a php processor show up as bold? I recently had help here getting a php email processor functioning properly and am just wanting to expand on this. I'm wanting to make certain parts of the $body show up in bold such as: $body = "Contact Information \n"; here is the full php code: <?php $yourEmail = "test.ca"; //The Email Address Form Results Will Be Sent To. Change to your email. $subject = "Quote Request"; //This will be displayed in your Email Subject line. Edit as needed. $body = "Contact Information \n"; $body .= "Name: {$_POST['field2']} \n"; $body .= "Best Day To Contact: {$_POST['field3']} \n"; $body .= " Phone: {$_POST['field4']} \n"; $body .= "Email Address: {$_POST['field5']} \n"; $body .= "Address: {$_POST['field6']} \n \n"; $body .= "Project Information \n"; $body .= "The Project Is: {$_POST['field1']} \n"; $body .= "Project Comments: {$_POST['field7']} \n"; $body .= "Client Heard About Us Via: {$_POST['field8']} \n"; mail($yourEmail, $subject, $body, "From: {$_POST['field2']} < {$_POST['field5']} >"); $thankyousubject = "Your Request Was Submitted Successfully."; //This will be displayed after a submission. Edit to suit your needs. The \n represent page breaks. $thankyoumsg = "Thank you {$_POST['field2']} for showing interest. We have recieved your information. We will reply shortly."; //This will be displayed after a submission. Edit to suit your needs. ?> <html> <body style="background-color:#000000;color:#FFFFFF"> <center> <b><?php echo $thankyousubject; ?></b> <br /><br /> <?php echo $thankyoumsg; ?> <br /><br /><br /><br /> <a HREF="http://www.test.ca" TARGET="_top"> <IMG SRC="http://www.test.ca/images/formbanner.png" WIDTH="600" HEIGHT="100" ALT="Return to Walker Industries" BORDER="0"> </a> </center> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/187162-is-it-possible-to-bold-text/ Share on other sites More sharing options...
Lamez Posted January 4, 2010 Share Posted January 4, 2010 <?php $body = "<b>Contact Information</b> \n"; ?> is that what you are looking for? Quote Link to comment https://forums.phpfreaks.com/topic/187162-is-it-possible-to-bold-text/#findComment-988343 Share on other sites More sharing options...
ignace Posted January 4, 2010 Share Posted January 4, 2010 That should be: $body = "<strong>Contact Information</strong> \n"; b will be dropped in favor of strong Quote Link to comment https://forums.phpfreaks.com/topic/187162-is-it-possible-to-bold-text/#findComment-988353 Share on other sites More sharing options...
mrMarcus Posted January 4, 2010 Share Posted January 4, 2010 you'll need to set the header to allow for HTML: <?php //your other code... $headers = "From: {$_POST['field2']} <{$_POST['field5']}>\r\n"; $headers .= "Content-type: text/html\r\n"; mail($yourEmail, $subject, $body, $headers); ?> something like that. Quote Link to comment https://forums.phpfreaks.com/topic/187162-is-it-possible-to-bold-text/#findComment-988356 Share on other sites More sharing options...
Syrehn Posted January 4, 2010 Author Share Posted January 4, 2010 you'll need to set the header to allow for HTML: <?php //your other code... $headers = "From: {$_POST['field2']} <{$_POST['field5']}>\r\n"; $headers .= "Content-type: text/html\r\n"; mail($yourEmail, $subject, $body, $headers); ?> something like that. if i add the above it generates and email like the following: Contact Information Name: Test Phone: blank Email Address: blank Comments: test message vs how it was before: Contact Information Name: Test Name Phone: blank Email Address: test@test.com Comments: Test text Quote Link to comment https://forums.phpfreaks.com/topic/187162-is-it-possible-to-bold-text/#findComment-988429 Share on other sites More sharing options...
mikesta707 Posted January 4, 2010 Share Posted January 4, 2010 if its an html email you will have to use line breaks, and not newlines Quote Link to comment https://forums.phpfreaks.com/topic/187162-is-it-possible-to-bold-text/#findComment-988433 Share on other sites More sharing options...
Syrehn Posted January 5, 2010 Author Share Posted January 5, 2010 I'm just curious, if I do implement this, will it be more likely for emails sent by this script to be classified as spam/junk? and if so would it be better to generate it so that it gives both a simple text and a html (with the bold ect) version? or is there a way to get around it being filtered as spam if that is the case? Quote Link to comment https://forums.phpfreaks.com/topic/187162-is-it-possible-to-bold-text/#findComment-988976 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.