Jump to content

Is it possible to bold text?


Syrehn

Recommended Posts

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>

Link to comment
https://forums.phpfreaks.com/topic/187162-is-it-possible-to-bold-text/
Share on other sites

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.

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: [email protected] 
Comments: Test text 

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?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.