Forum Moderators: phranque

Message Too Old, No Replies

Formatting PHP Text

PHP Formatting Bold

         

keyelementmedia

1:37 pm on Nov 26, 2007 (gmt 0)

10+ Year Member



I don't use PHP at all really, just for forms, but I'm trying to bold some text that is sent in the email. It doesn't come from any of the form fields, it is something extra at the bottom the client wants.

I cut out the top part of the code I don't think anything there will solve the problem. The part I want to make bold is towards the end where it says, "Once these warranty item(s) are completed they must be signed off and dated by homeowner. No other requests for warranty repair(s) will be accepted until previous requests have been signed off by homeowner."

I tried just using regular HTML tags, tried using an "echo" , but that screws up the page that I am calling after the form is submitted. All I want is to bold and under-line the text at the bottom that appears in the form email sent to the client. Thanks.

Code:

//Sending Email to form owner
$pfw_header = "From: $Email\n"
. "Reply-To: $Email\n";
$pfw_subject = "Warranty Request";
$pfw_email_to = "jared@keyelementmedia.com";
$pfw_message = "FirstName: $FirstName\n"
. "LastName: $LastName\n"
. "Address: $Address\n"
. "City: $City\n"
. "State: $State\n"
. "Zip: $Zip\n"
. "Email: $Email\n"
. "HomePhone: $HomePhone\n"
. "WorkPhone: $WorkPhone\n"
. "OtherPhone: $OtherPhone\n"
. "ClosingDate: $ClosingDate\n"
. "WarrantyRequest1: $WarrantyRequest1\n"
. "WarrantyRequest2: $WarrantyRequest2\n"
. "WarrantyRequest3: $WarrantyRequest3\n"
. "WarrantyRequest4: $WarrantyRequest4\n"
. "WarrantyRequest5: $WarrantyRequest5\n"
. "WarrantyRequest6: $WarrantyRequest6\n"
. "\n"
. "\n"
. "\n"
. "Once these warranty item(s) are completed they must be signed off and dated by homeowner. No other requests for warranty repair(s) will be accepted until previous requests have been signed off by homeowner.\n"
."\n"
."\n"
."\n"
."\n"
. "____________________________________ _________________\n"
. "Homeowner Signature Date\n"
. "";

@mail($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ) ;

header("Location: warranty-submit.htm");

?>

vincevincevince

1:42 pm on Nov 26, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The problem is that you are sending the email as plaintext not HTML. As such, there is no way to apply bold formatting.

keyelementmedia

3:09 pm on Nov 26, 2007 (gmt 0)

10+ Year Member



Thank you. How would I send it through PHP in HTML? Just put in the standard HTML tags after the <? ? Thanks. As you can tell I have very limited knowledge of PHP.

vincevincevince

3:42 pm on Nov 26, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You start your email body here:
$pfw_message = "FirstName: $FirstName\n"

Essentially, to send as HTML, you would need to be putting out HTML code into the $pfw_message:

$pfw_message = "<html><body>FirstName: $FirstName<br>" etc...

$pfw_header will also need 'Content-type: text/html' added to it

That will output the whole email as HTML; but will appear as HTML code or as a download to email clients without HTML support. To support both types of email client, you need a multipart-alternative format; you should search online for the term to read up about it.

bcolflesh

3:53 pm on Nov 26, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Definitely consider integrating PHPMailer:

[sourceforge.net...]

There are many tutorials on the sourceforge site that explain sending multipart emails.

jtara

6:11 pm on Nov 26, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You realize, of course, that you will have no idea whether your users will actually see bold text or will, in fact, see unintelligible HTML tags mixed with the text you want to bold.

Did you really intended to emphasize this paragraph to some of your users, while having some of them not notice it at all?