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
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.

Link to comment
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.

 

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 

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.