Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Bold

Featured Replies

How do I get this writing to be bold:

 

$sent = mail ($to, $subject,"Name: $fullname\r\n\r\nCompany: $company\r\n\r\nEmail: $email\r\n\r\nTel No: $telno\r\n\r\nEnquiry: $enquiry", $headers);

Edited by POWERPLAY27

How do I get this writing to be bold:

 

$sent = mail ($to, $subject,"Name: $fullname\r\n\r\nCompany: $company\r\n\r\nEmail: $email\r\n\r\nTel No: $telno\r\n\r\nEnquiry: $enquiry", $headers);

 

u have to set the content-type in your headers to allow html then u can put html tags directly inside ur emails

You're now venturing into HTML email territory, Some users may not have set their emmail client to view HTML emails, and it is more complicated to send them. As Webdesigner93 says,

$headers = ‘MIME-Version: 1.0′ . “\r\n”;
$headers .= ‘Content-type: text/html; charset=iso-8859-1′ . “\r\n”;
$headers .= ‘From: $admin';

Then code the mail function

$sent = mail ($to, $subject, "<span style=\"color: red;\">Name:</span> $fullname\r\n\r\n<span style=\"color: red;\">Company:</span> $company\r\n\r\nEmail: $email\r\n\r\n<span style=\"color: red;\">Tel No:</span>$telno\r\n\r\n<span style=\"color: red;\">Enquiry:</span> $enquiry", $headers);

might do it but I haven't tested.

Edited by Wickham

  • Author

Tried it, can't get it to work.

 

 

 

I will just leave it as it is, as long as the information is sent to email I am happy.

Edited by POWERPLAY27

I was a bit simplistic with my reply and this forum has a habit of changing vertical quotes (single and double) intop sloping quotes, even though I copy/pasted from vertical quotes.

 

This worked, sent via my own domain server:

<!doctype html>
<html>
<head>
<meta name="keywords" content="Wickham">
<meta name="description" content="HTML and CSS ">
<title>Form to send html email</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body>

<div id="contact">
<form class="contactcontent" name="myForm" METHOD="post"
ACTION="powerplay120927.php" >
<label for="fullname">Full
Name:</label> <input type="text" id="fullname"
name="fullname" size="40" ><br /><br />
<label for="company">Company:</label> <input
type="text" id="company" name="company" size="40"
><br /><br />
<label for="email">Email
Address:</label> <input type="text" id="email"
name="email" size="40" ><br /><br />
<label for="telno">Contact
Tel No:</label> <input type="text" id="telno"
name="telno" size="20" ><br /><br /><br /><br />
<label for="enquiry">Please
Insert Your Enquiry Here:</label> <br />
<textarea name="enquiry" id="enquiry" rows="10"
cols="65"></textarea><br /><br />
<input type="submit" id="submit" value="Submit"
name="submit"/><input type="reset" id="clearFrm" Value="Clear Form" name="Reset"/>
</form>
</div>
</body>
</html>

powerplay120927.php action file

<?php

$to = "mail@my-domain.com";
$subject = "Contact_Us";
$fullname = $_POST['fullname'];
$company = $_POST['company'];
$email = $_POST['email'] ;
$telno =$_POST['telno'];
$enquiry =$_POST['enquiry'];
$admin= "mail@my-domain.com";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-utf-8' . "\r\n";
$headers .= "From: $admin";

$message = "
<html>
<head>
<title>HTML & CSS Tutorial</title>
</head>
<body>
<p><span style=\"color: red;\">Name:</span>" . "
$fullname" . "<br><br><span style=\"color: red;
\">Company:</span>" . " $company" . "<br><br>Email:
" . "$email" . "<br><br><span style=\"color: red;
\">Tel No:</span>" . "$telno" . "<br><br><span
style=\"color: red;\">Enquiry:</span>" . " $enquiry"
. "</p></body></html>
";

$sent = mail ($to, $subject, $message, $headers);

if($sent)
{print "Thank you, we have received your enquiry and
we will try to respond back to you within 48 hours."; }
else{ print "We encountered an error and did not
receive your enquiry.";}

?>

 

I tested the above using my domain for my email address. However, there are security issues and some security code should be added to check email addresses and top prevent header injection.

Edited by Wickham

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.