Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8315209
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T21:04:50+00:00 2026-06-08T21:04:50+00:00

I have a form on a site that allows the user to enter their

  • 0

I have a form on a site that allows the user to enter their name, phone, email etc. When I receive this information as an email it comes in completly unformated, so it’s a little harder to read. See image below:

incoming email screen shot

Is there a way I can style this using CSS, ie. make the From and email headings bold {font-weight:bold;}?

The php I’m using for the form is:

<?php
$name        = $_POST['name'];
$email       = $_POST['email'];
$phone       = $_POST['phone'];
$message     = $_POST['message'];
$formcontent ="From: $name \n Email: $email \n Phone: $phone \n Message: $message";
$recipient   = "studio@ll-i.co.uk";
$subject     = "Contact Form";
$mailheader  = "From: $email \r\n";

mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");

echo "<p>Thanks for getting in touch, we'll get back to you shortly..</p>";
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T21:04:51+00:00Added an answer on June 8, 2026 at 9:04 pm

    You have to style it with inline CSS / CSS embedded in the of a HTML file.

    The $formcontent variable can contain HTML e.g.

    "<html>
        <head>
            <title>Message</title>
        </head>
        <body>
            <p><strong>From:</strong> $name</p>
            <p><strong>Email:</strong> $email</p>
            <p><strong>Phone:</strong> $phone</p>
            <p><strong>Message:</strong> $message</p>
        </body>
    </html>"
    

    Put the CSS in the head of this like so:

    <head>
       <style type="text/css">
           body { background-color: #ff0000; }
       </style>
    </head>
    

    Obviously you’ll have to use these: ‘ instead of these ” and concatenate any variables using either a full stop or comma incase you need to use speech quotes for any of the HTML.

    Like this:

    '<html>
        <head>
            <title>Message</title>
            <style type="text/css">
               body { background-color: #ff0000; }
            </style>
        </head>
        <body>
            <p><strong>From:</strong> ',$name,'</p>
            <p><strong>Email:</strong> ',$email,'</p>
            <p><strong>Phone:</strong> ',$phone,'</p>
            <p><strong>Message:</strong> ',$message,'</p>
        </body>
    </html>'
    

    EDIT:

    You should also change your headers like so:

    $mailheader = "MIME-Version: 1.0" . "\r\n";
    $mailheader .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
    $mailheader .= "From: $email \r\n";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web site that contains an HTML form, in this form I
I have a user form with a textarea that allows users to submit html
I have an ASP MVC 3 site that allows a user to submit some
I have a form (will add form validation later) that allows the user to
I have a site that uses a GET form to allow a user to
I have an area of my site which allows a user to enter a
I have a search form on my site that submits the url in the
I have a form that submits a search for blogs on my site via
On my site, I have a form that users fill out to become a
I have a win form that creates a site in IIS7. One function needs

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.